Skip to:
Content
Pages
Categories
Search
Top
Bottom

restrict messages to user-admin-user


  • 5high
    Participant

    @5high

    Hi there,

    currently running a new WP install with BP, rtmedia, s2member, bullet proof security and Kleo theme.

    What I’d like to do is just like many others – only allow BP messaging between admin and users – so not user to user.

    I found a possible solution to this in a previous thread here ( https://buddypress.org/support/topic/is-it-possible-only-user-admin-user-private-messages/ ), but needed some more details of the code mentioned. As it’s now closed I had to open a new thread…

    @djpaul mentioned you’d solved it using s2member plugin – can you share how you did this here? Or any extra code and where you put it?

    or if there’s a Bddypress way to do this I’d be keen to know too!

    Many thanks BP forum users 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

  • 5high
    Participant

    @5high

    OK, I don’t think the s2member route is an option for our membership structure, so it needs to be a Buddypress solution…

    I’ve tried various options with the code suggested in the link I posted above but so far it’s not right. This is what i have added into compose.php:

    			if ( !is_super_admin() ) {
    			input type=”hidden” name=”send-to-input” value=”admin”
    			} else {
    			input type=”text” name=”send-to-input”
    			}

    but I’m obviously not putting it in the correct place – or perhaps I need to edit out some bits too??

    Maybe @henrywright-1 or @lavishdhand could post their fix for this – just with a little more clarity as to where in compose.php it should go please?

    I’d really appreciate it if anyone could give some advice here!

    Thanks.


    ekko848
    Participant

    @ekko848

    I was googling this and came to this thread. Ended taking some hints from it and edited my compose.php to look like this:

     <?php if ( bp_current_user_can( 'bp_moderate' ) ) : ?>
        <label for="send-to-input"><?php _e("Send To (Username or Friend's Name)", 'buddypress' ); ?></label>
    	<ul class="first acfb-holder">
    		<li>
    			<?php bp_message_get_recipient_tabs(); ?>
    			<input type="text" name="send-to-input" class="send-to-input" id="send-to-input" />
    		</li>
    	</ul>
        <?php else : ?>
        <label for="send-to-input"><?php _e("SEND MESSAGE TO ADMIN", 'buddypress' ); ?></label>
    	<ul class="first acfb-holder">
    		<li>
    			<?php bp_message_get_recipient_tabs(); ?>
    			<input type="hidden" name="send-to-input" class="send-to-input" id="send-to-input" value="admin"/>
    		</li>
    	</ul>
    	<?php endif; ?>

    Just did some initial testing and it seems to work properly..


    Earl_D
    Participant

    @earl_d

    Would this work in a BP-custom.php file

    @Earl_D: No. The above snippets are added to a custom version of the buddypress/members/single/messages/compose.php file. Basically, if you add this file to your theme (following the structure buddypress/members/single/messages/), it will be used in preference to the one BuddyPress ships with. Read more about adding custom template parts: https://codex.buddypress.org/themes/theme-compatibility-1-7/a-quick-look-at-1-7-theme-compatibility/


    Earl_D
    Participant

    @earl_d

    @Dcavins thanks for the explanation I am learning more and more about the many ways of cutomizing BP kudos to all who built in such customization options.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar