Make user status update button available only to admin
- 
		OK Here’s what I’m trying to do: In a member profile, a users status should be publicly viewable. The only people who should be able to update a users status is Admin. Even registered members shouldn’t be allowed to update their status. Also this part: “18 hours, 1 minute ago” I want to edit so that the same text displays all the time. I want to change it to: “To xxxxxx. T&C’s [Hyperlink] apply”. Can anyone tell me how I’d go about doing this? I don’t see the relative ‘if’ tags in profile/index.php that allow logged in users to edit their status, so started looking elsewhere. The only place I see something that maybe what I need to edit is- /buddypress/bp-status/bp-status-templatetags.php Here’s what’s there: <?php
 
 function bp_the_status( $args = false ) {
 /***
 * To support updating your status without JS, we can display the update form when the GET var "status" is set
 * to "new".
 */
 if ( 'new' == $_GET['status'] && is_user_logged_in() ) {
 locate_template( array( 'status/post-form.php' ), true );
 } else {
 if ( 'clear' == $_GET['status'] && is_user_logged_in() )
 bp_status_clear_status();
 
 echo bp_get_the_status( $args );
 }
 }
 function bp_get_the_status( $args = false ) {
 global $bp;
 
 $defaults = array(
 'user_id' => $bp->displayed_user->id,
 'clear_button_text' => __( 'Clear', 'buddypress' ),
 'new_button_text' => __( 'Update Your Status', 'buddypress' ),
 'no_anchor' => false
 );
 
 $r = wp_parse_args( $args, $defaults );
 extract( $r, EXTR_SKIP );
 
 if ( !$user_id )
 $user_id = $bp->displayed_user->id;
 
 $status = apply_filters( 'bp_status_from_usermeta', get_usermeta( $user_id, 'bp_status' ) );
 
 if ( empty($status) )
 return bp_get_update_status_button( 'text=' . $new_button_text );
 
 $time_since = sprintf( __( '%s ago', 'buddypress' ), bp_core_time_since( $status['recorded_time'] ) );
 $content = apply_filters( 'the_status_content', $status['content'] );
 
 if ( !(int)$no_anchor && $user_id == $bp->loggedin_user->id )
 $content = '<a href="' . bp_core_get_user_domain( $user_id ) . '?status=new" id="status-new-status">' . $content . '</a>';
 
 $content .= ' <span class="time-since">' . $time_since . '</span>';
 $content .= ' ' . bp_get_clear_status_button( 'text=' . $clear_button_text );
 
 return apply_filters( 'bp_get_the_status', $content );
 }
 
 function bp_update_status_button( $args = false ) {
 echo bp_get_update_status_button( $args );
 }
 function bp_get_update_status_button( $args = false ) {
 global $bp;
 
 $defaults = array(
 'user_id' => false,
 'text' => __( 'Update Your Status', 'buddypress' )
 );
 
 $r = wp_parse_args( $args, $defaults );
 extract( $r, EXTR_SKIP );
 
 if ( !$user_id )
 $user_id = $bp->displayed_user->id;
 
 if ( $user_id != $bp->loggedin_user->id )
 return false;
 
 return apply_filters( 'bp_get_update_status_button', '<div class="generic-button"><a href="' . bp_core_get_user_domain( $user_id ) . '?status=new" id="status-new-status">' . $text . '</a></div>' );
 }
 
 function bp_clear_status_button( $args = false ) {
 echo bp_get_clear_status_button( $args );
 }
 function bp_get_clear_status_button( $args = false ) {
 global $bp;
 
 $defaults = array(
 'user_id' => false,
 'text' => __( 'Clear', 'buddypress' )
 );
 
 $r = wp_parse_args( $args, $defaults );
 extract( $r, EXTR_SKIP );
 
 if ( !$user_id )
 $user_id = $bp->displayed_user->id;
 
 if ( $user_id != $bp->loggedin_user->id )
 return false;
 
 return apply_filters( 'bp_get_clear_status_button', '<a href="' . bp_core_get_user_domain( $user_id ) . '?status=clear" id="status-clear-status">' . $text . '</a>' );
 }
 
 function bp_status_form_action( $user_id = false ) {
 global $bp;
 
 if ( !$user_id )
 $user_id = $bp->loggedin_user->id;
 
 echo apply_filters( 'bp_status_form_action', bp_core_get_user_domain( $user_id ) . BP_STATUS_SLUG . '/add' );
 }
 
 function bp_the_status_css_class() {
 echo bp_get_the_status_css_class();
 }
 function bp_get_the_status_css_class() {
 return ( bp_loggedin_user_id() == bp_displayed_user_id() ) ? 'status-editable' : 'status-display';
 }
 
 ?>Can anyone help, or even tell me if I’m looking in the correct place? 
- The topic ‘Make user status update button available only to admin’ is closed to new replies.
