Skip to:
Content
Pages
Categories
Search
Top
Bottom

Buddypress on Mobile / Hide admin access


  • pjbursnall
    Participant

    @pjbursnall

    Hi,

    Very new to Buddypress so this may have already been answered. Can you tell me how BP is workable from mobile portrait orientation? I suspect the answer is that it’s not by default since the WP admin bar will not resize to fit. And neither does the WP Dashboard once you’re in there. That’s not good from a user perspective.

    The ideal solution for me would be to hide both the admin bar and panel from all users (except admin). What I can’t find is a way to make all the functionality of the BP drop down menu available in either a custom menu, or a widget.

    Is there a way I can add all functions of BP to the front-end? Then my theme will handle the responsive issues, and users won’t need to see admin areas they shouldn’t really see at all.

    Thanks,
    Paul.

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

  • mattg123
    Participant

    @mattg123

    @pjbursnall Personally I think buddypress should disable admin access anyway as most users don’t want it but that is neither here nor there. Recreating the admin bar is pretty easy, you need to know some css, html and a few bp functions to get the current users details like username etc, as for the notifications @modemlooper or @mercime posted this a while back (my apologies for not remembering which).

    function bp_notification_badge() {
    	if ( is_user_logged_in() ) {
    	global $current_user;
    	get_currentuserinfo();
    			$notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id() );
    				if ( empty($notifications)) {
    				echo '<li class="li-first" id="li-first-right"><a href="' . get_home_url() . '/members/' . $current_user->user_login . '"><span class="circle-zero">0</span></a><ul class="second-level" id="second-level-right"><li class="li-second"><a href="' . get_home_url() . '/members/' . $current_user->user_login . '">No new notifications!</a></li></ul></li>';
    				} else {
    						echo '<ul class="second-level" id="second-level-right">';
    					$counter = 0;
    						for ( $i = 0; $i < count($notifications); $i++ ) {
    						$badge = count($notifications);
    						echo '<li class="li-third">'.$notifications[$i].'</li>';		
    						}
    				echo '</ul>';
    				echo '<a href="' . get_home_url() . '/members/' . $current_user->user_login . '"><span class="circle-badge">'.$badge.'</span></a>';
    			}
    	}
    }

    As for actually disabling the admin bar + backend that can be done with a plugin, plenty of them just google.


    pjbursnall
    Participant

    @pjbursnall

    Hi Matt,

    Thanks for the quick reply. Agreed on the admin bar, seems kind of lazy to me in it’s current form. Please excuse my ignorance but where do I place the above? My theme’s functions.php? And will that just handle the notifications element?

    I’d like to find a proper fix for this as on some devices BP is completely unusable.

    Thanks again,
    Paul.


    mattg123
    Participant

    @mattg123

    @pjbursnall yeah that code replicates the notification element only (the only part that is somewhat confusing to replicate) you place the code in the plugins directory in bp-custom.php you may have to create the file yourself.

    http://stackoverflow.com/questions/9953482/how-to-make-a-pure-css-based-dropdown-menu – shows you how to create a drop down menu, https://codex.wordpress.org/Function_Reference/get_currentuserinfo get the current users info so you can create links to their profile pages, etc.

    Just a note, to add the notifcations to your custom bar your code will look something like <li><?php bp_notification_badge(); ?></li>


    pjbursnall
    Participant

    @pjbursnall

    Hi Matt,

    I have no issue creating a drop-down menu, the other side is a little trickier when you don’t know php, but I’ll have a good read.

    Seems BP is not as straightforward as it’s made out to be.

    Thanks,
    Paul.


    mattg123
    Participant

    @mattg123

    @pjbursnall , I wouldn’t say that it is pretty easy here

    <?php global $current_user;
    		get_currentuserinfo();
    		$display = $current_user->display_name;
    		$login = $current_user->user_login;
    		$userid = $current_user->ID;
                    $home = get_home_url();
    ?>

    add that above your custom drop-down then its pretty simple just echo out the username, url etc <li class="li-fourth"><a href="<?php echo $home . '/members/' . $login . '/activity/mentions'; ?>">Mentions</a></li>

    EDIT –

    Oh the other bit you’d have to google for is the avatar but here
    <?php echo bp_core_fetch_avatar( array('item_id' => $userid, 'type' => 'full', 'width' => 100,'height' => 100));?>
    You’ll want to adjust the width/height accordingly


    pjbursnall
    Participant

    @pjbursnall

    Thanks again Matt, I’ll have a look tomorrow. My previous point is the BP doesn’t work ‘out the box’ when you move onto mobile/tablet. Something of a failing.

    Thanks,
    Paul.


    pjbursnall
    Participant

    @pjbursnall

    Thanks 🙂


    modemlooper
    Moderator

    @modemlooper

    check the WP plugin repo there are some plugins to make the admin bar work better on mobile


    pjbursnall
    Participant

    @pjbursnall

    Ok I’ll have a look and test each option. My preference is to hide both the admin bar and dashboard (as I would think most people would want to), but I will look at those plugins.

    Going forwards I would suggest a lot of people would be happier with BP if normal users could run through all functions with ever seeing the admin bar or dashboard.

    Thanks,
    Paul.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Buddypress on Mobile / Hide admin access’ is closed to new replies.
Skip to toolbar