{"id":1499,"date":"2018-08-03T19:53:20","date_gmt":"2018-08-03T17:53:20","guid":{"rendered":"https:\/\/tulipemedia.com\/?p=1499"},"modified":"2025-05-15T17:59:43","modified_gmt":"2025-05-15T15:59:43","slug":"buddypress-reindirizza-la-pagina-di-registrazione-dellutente-non-registrato-nella-rete-privata","status":"publish","type":"post","link":"https:\/\/tulipemedia.com\/it\/buddypress-redirect-non-logged-user-register-page-private-network\/","title":{"rendered":"Snippet: rendi BuddyPress privato, limita la directory e i profili dei membri solo ai membri"},"content":{"rendered":"<p>Stai cercando un piccolo plugin per rendere privato il tuo BuddyPress e limitare il tuo social network ai soli membri? Se s\u00ec, questo frammento \u00e8 per te.<\/p>\n<p>Con questa funzione, l&#039;utente non registrato che tenta di accedere al social network BuddyPress (directory o profilo dei membri) viene reindirizzato alla registrazione di BuddyPress.<\/p>\n<p><code>funzione sqr_prevent_search_guest_user() {<br \/>\n    se (class_esiste(&#039;BuddyPress&#039;)) {<br \/>\n        if (!is_user_logged_in() &amp;&amp; (bp_is_directory() || bp_is_user())) {<br \/>\n            wp_redirect(home_url() . &#039;\/register\/&#039;);<br \/>\n            Uscita;<br \/>\n        }<br \/>\n    }<br \/>\n}<br \/>\nadd_action(&#039;template_redirect&#039;, &#039;sqr_prevent_search_guest_user&#039;);<\/code><\/p>\n<p>La buona notizia \u00e8 che questo snippet \u00e8 compatibile con WPML, quindi i tuoi utenti francesi verranno reindirizzati alla versione francese della pagina di registrazione, ecc...<\/p>\n<p>Non esitate a usarlo <a href=\"https:\/\/fr.wordpress.org\/plugins\/my-custom-functions\/\" rel=\"noopener\" target=\"_blank\">Il mio plugin Funzioni personalizzate<\/a> per inserire questo codice nella tua installazione BuddyPress direttamente tramite la dashboard di WordPress!<\/p>","protected":false},"excerpt":{"rendered":"<p>Are you looking for a little plugin to make your BuddyPress private, and restrict your social network to members only? If yes, this snippet is for you. With this function, the non logged user who tries to access to BuddyPress social network (members directory or profile) is redirect to the BuddyPress registration. function sqr_prevent_search_guest_user() { [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":1498,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[164],"class_list":["post-1499","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-buddypress","tag-tips-wordpress"],"_links":{"self":[{"href":"https:\/\/tulipemedia.com\/it\/wp-json\/wp\/v2\/posts\/1499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tulipemedia.com\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tulipemedia.com\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tulipemedia.com\/it\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/tulipemedia.com\/it\/wp-json\/wp\/v2\/comments?post=1499"}],"version-history":[{"count":1,"href":"https:\/\/tulipemedia.com\/it\/wp-json\/wp\/v2\/posts\/1499\/revisions"}],"predecessor-version":[{"id":4206,"href":"https:\/\/tulipemedia.com\/it\/wp-json\/wp\/v2\/posts\/1499\/revisions\/4206"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tulipemedia.com\/it\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/tulipemedia.com\/it\/wp-json\/wp\/v2\/media?parent=1499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tulipemedia.com\/it\/wp-json\/wp\/v2\/categories?post=1499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tulipemedia.com\/it\/wp-json\/wp\/v2\/tags?post=1499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}