Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'private'

Viewing 25 results - 1,301 through 1,325 (of 3,450 total)
  • Author
    Search Results
  • #170618
    Henry
    Member

    Just read through your original question. The code snippet you’d want to add to your theme’s functions.php is something like this:

    function bp_my_restrict() {
       global $bp;
       $user_id = bp_loggedin_user_id(); 
       $user = new WP_User( $user_id );
    	
          if ( bp_is_current_component('members') || bp_is_current_component('activity') ) {
    
             if ( ( $user->roles[0] != 'administrator' ) ) {
                wp_redirect( $bp->loggedin_user->domain );
    	    exit();
    	 }
          }
    }
    add_action('wp','bp_my_restrict');
    #170617
    Henry
    Member

    Try this

    <?php
    
       $user_id = bp_loggedin_user_id(); 
       $user = new WP_User( $user_id );
       
       if ( $user->roles[0] != 'administrator' ) {
         // your code
       }
    
    ?>
    #170615
    Squirrel
    Participant

    There is still a problem though in that if I do this it stops any member who is not an admin level user accessing their profile page. Not sure why it should affect that- tried with just the activity conditional and it stops profile page access as well.

    elseif (bp_is_current_component( 'members' ) || bp_is_current_component( 'activity' )) :
    get_header('restrict');

    I’m using a header-restrict.php which redirects them with this redirect at the very top of it:

    <?php if(!current_user_can('delete_others_pages')) { wp_redirect( home_url() ); exit; } ?>

    Any ideas?

    #170614
    them8z
    Participant

    I disabled the plugin “simple chat” and it worked again!

    #170613
    Squirrel
    Participant

    Thanks for your help Henry- I tried the is_page conditional but it does not work with the BuddyPress Pages.

    So I tried bp_is_Page which worked, but was depecated.
    Then I tried
    bp_is_current_component( 'activity' ) || bp_is_current_component( 'members' )
    and they work for what I want.

    Thanks for your feedback it helped a lot 🙂

    Chris

    #170611
    Henry
    Member

    You could use the WordPress conditional is_page() to check if the user is on the activity or members page:

    if ( is_page('members') || is_page('activity') ) {
    
    } else {
    
    }

    Note: I’m assuming you haven’t changed the default slugs

    koomak
    Participant

    Is there anyone to help on this ?

    #170404
    funmi omoba
    Participant

    @shanebp,

    thanks for your reply I thought as much but I think it get wiped during the plugin update.

    Thanks for your input anyways.

    Best Regards

    #170403
    shanebp
    Moderator

    @funmi-omoba

    Open the plugin file, find the text, replace the text

    #170400
    funmi omoba
    Participant

    @shanebp,

    Thanks for your snippet which works great with standard buddypress message system but did not work if using BP Profile Message UX plugin, is there anyway to make it work please

    https://wordpress.org/plugins/bp-profile-message-ux/

    tahnks

    #170393
    Henry
    Member

    @shanebp – oops thanks for pointing that out. global $bp; can be removed

    #170392
    Henry
    Member

    @shanebp good point about using the bp_send_private_message_link approach. Although you would avoid double buttons by using a translation file.

    #170389
    shanebp
    Moderator

    @henrywright-1
    And how would you avoid double buttons due to this call in member-header.php?
    do_action( ‘bp_member_header_actions’ );


    @tayenewm

    Use the provided apply_filters:

    function tweak_button_label ( $args ) { 
    	$args[link_text] = 'Something'; 
    	return $args;
    }
    add_filter( 'bp_get_send_message_button_args', 'tweak_button_label', 1, 1 );
    #170388
    shanebp
    Moderator

    @henrywright-1
    Don’t include the global if you aren’t going to use it.

    #170387
    Henry
    Member

    actually you could make use of the bp_send_private_message_link function and do it like this:

    <a href="<?php bp_send_private_message_link() ?>" title="Private Message">Private Message</a>

    You can change the “Private Message” text to whatever you like. You’d just paste the code into your theme where ever you’d like the button to appear

    #170386
    Henry
    Member

    You could do it like that but each time you update BuddyPress you’ll lose the changes you’ve made to bp-messages-template.php. I’d try to avoid making changes to the plugin core.

    #170385
    tayenewm
    Participant

    That process seems beyond me and very long (and I cannot find the /plugins/buddypress/bp-languages folder) I just want to change the “Private Message” button label. Can I access/change it quickly like this:
    1. access buddypress/bp-messages/bp-messages-template.php
    2. change the ‘link text’ to the new label name in this block of code?

    function bp_get_send_message_button() {
    // Note: ‘bp_get_send_message_button’ is a legacy filter. Use
    // ‘bp_get_send_message_button_args’ instead. See #4536
    return apply_filters( ‘bp_get_send_message_button’,
    bp_get_button( apply_filters( ‘bp_get_send_message_button_args’, array(
    ‘id’ => ‘private_message’,
    ‘component’ => ‘messages’,
    ‘must_be_logged_in’ => true,
    ‘block_self’ => true,
    ‘wrapper_id’ => ‘send-private-message’,
    ‘link_href’ => bp_get_send_private_message_link(),
    ‘link_title’ => __( ‘Send a private message to this user.’, ‘buddypress’ ),
    ‘link_text’ => __( ‘Private Message’, ‘buddypress’ ),
    ‘link_class’ => ‘send-message’,
    ) ) )

    #170384
    Henry
    Member

    you would add something like this to your theme’s functions.php

    function bp_disable_messaging() {
    	global $bp;
    	
    	if ( USER_TO_DISALLOW && bp_is_current_component('messages') ) {
    		wp_redirect( home_url() );
    		exit();
    	}
    }
    add_action('wp','bp_disable_messaging');

    Note: USER_TO_DISALLOW would be your unpaid WooCommerce users. You would need to get whatever this was from WooCommerce as I’m not familiar with the plugin. Once you’ve added that bit in the code should work.

    #170380
    Henry
    Member

    This will help you. It shows you how to change most of the text labels and messages outputted by BuddyPress:

    https://codex.buddypress.org/developer/customizing/customizing-labels-messages-and-urls/

    Will there ever be a resolution to this problem? BP 1.8 with bbPress 2.3.2 on WP 3.6 still sees forum posts in Private groups appearing in non-group members’ activity streams!

    shanebp
    Moderator

    You’ll need to know the user_id for the teacher.

    Then check the array for that id. If it’s found, remove it.

    And tell the student why, something like:

    bp_core_add_message( __( 'You cannot send a private message to the teacher.', 'buddypress' ), 'error' );

    Artisantopia
    Participant

    thank you @shanebp.

    I only know enough about filters to get myself into trouble! I’ve just had a look at that one. Are you suggesting that I remove the teacher from the array so they don’t show in the list of members to send to? Is that how that works?

    How would that work from the member/student perspective?

    I really appreciate any guidance you can give me.

    Thank you.

    shanebp
    Moderator

    Do you know how to use filters?

    Take a look at function send() in
    \buddypress\bp-messages\bp-messages-classes.php

    It has lots of filters.
    I’d use the do_action_ref_array

    Rachel Biel
    Participant

    A related issue is how forum post links show up elsewhere. For example, we have a private group on facebook and I am directing them to the various forum topics that I am creating. All of the links show up as TAFA Forum Group. It gets really confusing if you post a lot of them. I would think this also has to do with how the permalinks and feeds show up. I don’t know if this is a buddypress or bbpress issue, but I hope it’s addressed in future updates. Social media is a part of our world now and buddypress needs to be able to function just as wordpress does if content can have viral potential.

    Hugo Ashmore
    Participant

    Closing thread.


    @whitewolf1988
    Please avoid name calling, even in jest. People have the right to monetize their work if they so wish, it’s a common plugin model to have free version and premium, why do think people should work for no return?

Viewing 25 results - 1,301 through 1,325 (of 3,450 total)
Skip to toolbar