Skip to:
Content
Pages
Categories
Search
Top
Bottom

Is it possible in Buddy Press to give only permission to delete private message


  • Anonymous User 16484011
    Inactive

    @anonymized-16484011

    Hi !

    It is possible in buddy press to private message delete permission to only admin. Not even the person who sent message.

    For example if any role’s user sent private message to anyone but after sending message they can’t see the sent message delete option.

    Thanks

Viewing 25 replies - 1 through 25 (of 26 total)

  • Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    Please try to find the template named index.php in bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php and there you will find the HTML. You just need to put that button code in condition of yours. That is if user role is this then only show otherwise not.

    You can try: if(current_user_can('manage_options')){ ?> // Button HTML Code here <?php }?>
    One last thing, if you have child theme then try to override the file there and then change otherwise on next update changes will be lost.

    Thanks


    Anonymous User 16484011
    Inactive

    @anonymized-16484011

    Hi ! Prashant !

    Thanks for your time. But I am zero in buddypress & coding. So, As per your path I find the index file but I can’t get where can I use your above code and where can I add role name administrator ? I put my file here ! Can you please edit it for me ?

    <?php
    /**
     * BP Nouveau Messages main template.
     *
     * This template is used to inject the BuddyPress Backbone views
     * dealing with user's private messages.
     *
     * @since 3.0.0
     * @version 3.1.0
     */
    ?>
    <div class="subnav-filters filters user-subnav bp-messages-filters" id="subsubnav"></div>
    
    <div class="bp-messages-feedback"></div>
    <div class="bp-messages-content"></div>
    
    <script type="text/html" id="tmpl-bp-messages-feedback">
    	<div class="bp-feedback {{data.type}}">
    		<span class="bp-icon" aria-hidden="true"></span>
    		<p>{{{data.message}}}</p>
    	</div>
    </script>
    
    <?php
    /**
     * This view is used to inject hooks buffer
     */
    ?>
    <script type="text/html" id="tmpl-bp-messages-hook">
    	{{{data.extraContent}}}
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-form">
    	<?php bp_nouveau_messages_hook( 'before', 'compose_content' ); ?>
    
    	<label for="send-to-input"><?php esc_html_e( 'Send @Username', 'buddypress' ); ?></label>
    	<input type="text" name="send_to" class="send-to-input" id="send-to-input" />
    
    	<label for="subject"><?php _e( 'Subject', 'buddypress' ); ?></label>
    	<input type="text" name="subject" id="subject"/>
    
    	<div id="bp-message-content"></div>
    
    	<?php bp_nouveau_messages_hook( 'after', 'compose_content' ); ?>
    
    	<div class="submit">
    		<input type="button" id="bp-messages-send" class="button bp-primary-action" value="<?php echo esc_attr_x( 'Send', 'button', 'buddypress' ); ?>"/>
    		<input type="button" id="bp-messages-reset" class="text-button small bp-secondary-action" value="<?php echo esc_attr_x( 'Reset', 'form reset button', 'buddypress' ); ?>"/>
    	</div>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-editor">
    	<?php
    	// Add a temporary filter on editor buttons
    	add_filter( 'mce_buttons', 'bp_nouveau_messages_mce_buttons', 10, 1 );
    
    	wp_editor(
    		'',
    		'message_content',
    		array(
    			'textarea_name' => 'message_content',
    			'teeny'         => false,
    			'media_buttons' => false,
    			'dfw'           => false,
    			'tinymce'       => true,
    			'quicktags'     => false,
    			'tabindex'      => '3',
    			'textarea_rows' => 5,
    		)
    	);
    
    	// Remove the temporary filter on editor buttons
    	remove_filter( 'mce_buttons', 'bp_nouveau_messages_mce_buttons', 10, 1 );
    	?>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-paginate">
    	<# if ( 1 !== data.page ) { #>
    		<button id="bp-messages-prev-page"class="button messages-button">
    			<span class="dashicons dashicons-arrow-left"></span>
    			<span class="bp-screen-reader-text"><?php echo esc_html_x( 'Previous page', 'link', 'buddypress' ); ?></span>
    		</button>
    	<# } #>
    
    	<# if ( data.total_page !== data.page ) { #>
    		<button id="bp-messages-next-page"class="button messages-button">
    			<span class="dashicons dashicons-arrow-right"></span>
    			<span class="bp-screen-reader-text"><?php echo esc_html_x( 'Next page', 'link', 'buddypress' ); ?></span>
    		</button>
    	<# } #>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-filters">
    	<li class="user-messages-search" role="search" data-bp-search="{{data.box}}">
    		<div class="bp-search messages-search">
    			<?php bp_nouveau_message_search_form(); ?>
    		</div>
    	</li>
    	<li class="user-messages-bulk-actions"></li>
    </script>
    
    <script type="text/html" id="tmpl-bp-bulk-actions">
    	<input type="checkbox" id="user_messages_select_all" value="1"/>
    	<label for="user_messages_select_all"><?php esc_html_e( 'All Messages', 'buddypress' ); ?></label>
    	<div class="bulk-actions-wrap bp-hide">
    		<div class="bulk-actions select-wrap">
    			<label for="user-messages-bulk-actions" class="bp-screen-reader-text">
    				<?php esc_html_e( 'Select bulk action', 'buddypress' ); ?>
    			</label>
    			<select id="user-messages-bulk-actions">
    				<# for ( i in data ) { #>
    					<option value="{{data[i].value}}">{{data[i].label}}</option>
    				<# } #>
    			</select>
    			<span class="select-arrow" aria-hidden="true"></span>
    		</div>
    		<button class="messages-button bulk-apply bp-tooltip" type="submit" data-bp-tooltip="<?php echo esc_attr_x( 'Apply', 'button', 'buddypress' ); ?>">
    			<span class="dashicons dashicons-yes" aria-hidden="true"></span>
    			<span class="bp-screen-reader-text"><?php echo esc_html_x( 'Apply', 'button', 'buddypress' ); ?></span>
    		</button>
    	</div>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-thread">
    	<div class="thread-cb">
    		<input class="message-check" type="checkbox" name="message_ids[]" id="bp-message-thread-{{data.id}}" value="{{data.id}}">
    		<label for="bp-message-thread-{{data.id}}" class="bp-screen-reader-text"><?php esc_html_e( 'Select message:', 'buddypress' ); ?> {{data.subject}}</label>
    	</div>
    
    	<# if ( ! data.recipientsCount ) { #>
    		<div class="thread-from">
    			<a class="user-link" href="{{data.sender_link}}">
    				<img class="avatar" src="{{data.sender_avatar}}" alt="" />
    				<span class="bp-screen-reader-text"><?php esc_html_e( 'From:', 'buddypress' ); ?></span>
    				<span class="user-name">{{data.sender_name}}</span>
    			</a>
    		</div>
    	<# } else {
    		var recipient = _.first( data.recipients );
    		#>
    		<div class="thread-to">
    			<a class="user-link" href="{{recipient.user_link}}">
    				<img class="avatar" src="{{recipient.avatar}}" alt="" />
    				<span class="bp-screen-reader-text"><?php esc_html_e( 'To:', 'buddypress' ); ?></span>
    				<span class="user-name">{{recipient.user_name}}</span>
    			</a>
    
    			<# if ( data.toOthers ) { #>
    				<span class="num-recipients">{{data.toOthers}}</span>
    			<# } #>
    		</div>
    	<# } #>
    
    	<div class="thread-content" data-thread-id="{{data.id}}">
    		<div class="thread-subject">
    			<span class="thread-count">({{data.count}})</span>
    			<a class="subject" href="../view/{{data.id}}/">{{data.subject}}</a>
    		</div>
    		<p class="excerpt">{{data.excerpt}}</p>
    	</div>
    	<div class="thread-date">
    		<time datetime="{{data.date.toISOString()}}">{{data.display_date}}</time>
    	</div>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-preview">
    	<# if ( undefined !== data.content ) { #>
    
    		<h2 class="message-title preview-thread-title"><?php esc_html_e( 'Active conversation:', 'buddypress' ); ?><span class="messages-title">{{{data.subject}}}</span></h2>
    		<div class="preview-content">
    			<header class="preview-pane-header">
    
    				<# if ( undefined !== data.recipients ) { #>
    					<dl class="thread-participants">
    						<dt><?php esc_html_e( 'Participants:', 'buddypress' ); ?></dt>
    						<dd>
    							<ul class="participants-list">
    								<# for ( i in data.recipients ) { #>
    									<li><a href="{{data.recipients[i].user_link}}" class="bp-tooltip" data-bp-tooltip="{{data.recipients[i].user_name}}"><img class="avatar mini" src="{{data.recipients[i].avatar}}" alt="{{data.recipients[i].user_name}}" /></a></li>
    								<# } #>
    							</ul>
    						</dd>
    					</dl>
    				<# } #>
    
    				<div class="actions">
    
    					<button type="button" class="message-action-delete bp-tooltip bp-icons" data-bp-action="delete" data-bp-tooltip="<?php esc_attr_e( 'Delete conversation.', 'buddypress' ); ?>">
    						<span class="bp-screen-reader-text"><?php esc_html_e( 'Delete conversation.', 'buddypress' ); ?></span>
    					</button>
    
    					<# if ( undefined !== data.star_link ) { #>
    
    						<# if ( false !== data.is_starred ) { #>
    							<a role="button" class="message-action-unstar bp-tooltip bp-icons" href="{{data.star_link}}" data-bp-action="unstar" aria-pressed="true" data-bp-tooltip="<?php esc_attr_e( 'Unstar Conversation', 'buddypress' ); ?>">
    								<span class="bp-screen-reader-text"><?php esc_html_e( 'Unstar Conversation', 'buddypress' ); ?></span>
    							</a>
    						<# } else { #>
    							<a role="button" class="message-action-star bp-tooltip bp-icons" href="{{data.star_link}}" data-bp-action="star" aria-pressed="false" data-bp-tooltip="<?php esc_attr_e( 'Star Conversation', 'buddypress' ); ?>">
    								<span class="bp-screen-reader-text"><?php esc_html_e( 'Star Conversation', 'buddypress' ); ?></span>
    							</a>
    						<# } #>
    
    					<# } #>
    
    					<a href="../view/{{data.id}}/" class="message-action-view bp-tooltip bp-icons" data-bp-action="view" data-bp-tooltip="<?php esc_attr_e( 'View full conversation and reply.', 'buddypress' ); ?>">
    						<span class="bp-screen-reader-text"><?php esc_html_e( 'View full conversation and reply.', 'buddypress' ); ?></span>
    					</a>
    
    					<# if ( data.threadOptions ) { #>
    						<span class="bp-messages-hook thread-options">
    							{{{data.threadOptions}}}
    						</span>
    					<# } #>
    				</div>
    			</header>
    
    			<div class='preview-message'>
    				{{{data.content}}}
    			</div>
    
    			<# if ( data.inboxListItem ) { #>
    				<table class="bp-messages-hook inbox-list-item">
    					<tbody>
    						<tr>{{{data.inboxListItem}}}</tr>
    					</tbody>
    				</table>
    			<# } #>
    		</div>
    	<# } #>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-single-header">
    	<h2 id="message-subject" class="message-title single-thread-title">{{{data.subject}}}</h2>
    	<header class="single-message-thread-header">
    		<# if ( undefined !== data.recipients ) { #>
    			<dl class="thread-participants">
    				<dt><?php esc_html_e( 'Participants:', 'buddypress' ); ?></dt>
    				<dd>
    					<ul class="participants-list">
    						<# for ( i in data.recipients ) { #>
    							<li><a href="{{data.recipients[i].user_link}}" class="bp-tooltip" data-bp-tooltip="{{data.recipients[i].user_name}}"><img class="avatar mini" src="{{data.recipients[i].avatar}}" alt="{{data.recipients[i].user_name}}" /></a></li>
    						<# } #>
    					</ul>
    				</dd>
    			</dl>
    		<# } #>
    
    		<div class="actions">
    			<button type="button" class="message-action-delete bp-tooltip bp-icons" data-bp-action="delete" data-bp-tooltip="<?php esc_attr_e( 'Delete conversation.', 'buddypress' ); ?>">
    				<span class="bp-screen-reader-text"><?php esc_html_e( 'Delete conversation.', 'buddypress' ); ?></span>
    			</button>
    		</div>
    	</header>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-single-list">
    	<div class="message-metadata">
    		<# if ( data.beforeMeta ) { #>
    			<div class="bp-messages-hook before-message-meta">{{{data.beforeMeta}}}</div>
    		<# } #>
    
    		<a href="{{data.sender_link}}" class="user-link">
    			<img class="avatar" src="{{data.sender_avatar}}" alt="" />
    			<strong>{{data.sender_name}}</strong>
    		</a>
    
    		<time datetime="{{data.date.toISOString()}}" class="activity">{{data.display_date}}</time>
    
    		<div class="actions">
    			<# if ( undefined !== data.star_link ) { #>
    
    				<button type="button" class="message-action-unstar bp-tooltip bp-icons <# if ( false === data.is_starred ) { #>bp-hide<# } #>" data-bp-star-link="{{data.star_link}}" data-bp-action="unstar" data-bp-tooltip="<?php esc_attr_e( 'Unstar Message', 'buddypress' ); ?>">
    					<span class="bp-screen-reader-text"><?php esc_html_e( 'Unstar Message', 'buddypress' ); ?></span>
    				</button>
    
    				<button type="button" class="message-action-star bp-tooltip bp-icons <# if ( false !== data.is_starred ) { #>bp-hide<# } #>" data-bp-star-link="{{data.star_link}}" data-bp-action="star" data-bp-tooltip="<?php esc_attr_e( 'Star Message', 'buddypress' ); ?>">
    					<span class="bp-screen-reader-text"><?php esc_html_e( 'Star Message', 'buddypress' ); ?></span>
    				</button>
    
    			<# } #>
    		</div>
    
    		<# if ( data.afterMeta ) { #>
    			<div class="bp-messages-hook after-message-meta">{{{data.afterMeta}}}</div>
    		<# } #>
    	</div>
    
    	<# if ( data.beforeContent ) { #>
    		<div class="bp-messages-hook before-message-content">{{{data.beforeContent}}}</div>
    	<# } #>
    
    	<div class="message-content">{{{data.content}}}</div>
    
    	<# if ( data.afterContent ) { #>
    		<div class="bp-messages-hook after-message-content">{{{data.afterContent}}}</div>
    	<# } #>
    
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-single">
    	<?php bp_nouveau_messages_hook( 'before', 'thread_content' ); ?>
    
    	<div id="bp-message-thread-header" class="message-thread-header"></div>
    
    	<?php bp_nouveau_messages_hook( 'before', 'thread_list' ); ?>
    
    	<ul id="bp-message-thread-list"></ul>
    
    	<?php bp_nouveau_messages_hook( 'after', 'thread_list' ); ?>
    
    	<?php bp_nouveau_messages_hook( 'before', 'thread_reply' ); ?>
    
    	<form id="send-reply" class="standard-form send-reply">
    		<div class="message-box">
    			<div class="message-metadata">
    
    				<?php bp_nouveau_messages_hook( 'before', 'reply_meta' ); ?>
    
    				<div class="avatar-box">
    					<?php bp_loggedin_user_avatar( 'type=thumb&height=30&width=30' ); ?>
    
    					<strong><?php esc_html_e( 'Send a Reply', 'buddypress' ); ?></strong>
    				</div>
    
    				<?php bp_nouveau_messages_hook( 'after', 'reply_meta' ); ?>
    
    			</div><!-- .message-metadata -->
    
    			<div class="message-content">
    
    				<?php bp_nouveau_messages_hook( 'before', 'reply_box' ); ?>
    
    				<label for="message_content" class="bp-screen-reader-text"><?php _e( 'Reply to Message', 'buddypress' ); ?></label>
    				<div id="bp-message-content"></div>
    
    				<?php bp_nouveau_messages_hook( 'after', 'reply_box' ); ?>
    
    				<div class="submit">
    					<input type="submit" name="send" value="<?php echo esc_attr_x( 'Send Reply', 'button', 'buddypress' ); ?>" id="send_reply_button"/>
    				</div>
    
    			</div><!-- .message-content -->
    
    		</div><!-- .message-box -->
    	</form>
    
    	<?php bp_nouveau_messages_hook( 'after', 'thread_reply' ); ?>
    
    	<?php bp_nouveau_messages_hook( 'after', 'thread_content' ); ?>
    </script>
    

    Thanks


    Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    <?php if(current_user_can('manage_options')){ ?>
    <button type="button" class="message-action-delete bp-tooltip bp-icons" data-bp-action="delete" data-bp-tooltip="<?php esc_attr_e( 'Delete conversation.', 'buddypress' ); ?>">
    <span class="bp-screen-reader-text"><?php esc_html_e( 'Delete conversation.', ',buddypress' ); ?></span>
    </button>
    <?php }?>

    You have to wrap the code like this. Just find the code that I put in condition and replace that with my code.

    You can search for class=”actions” and there you will find the code.

    Thanks


    Anonymous User 16484011
    Inactive

    @anonymized-16484011

    Hey !

    It’s not working or I can’t do properly. Can you please see my file and make a changes to delete only administrator users only show delete private message button ?

    <?php
    /**
     * BP Nouveau Messages main template.
     *
     * This template is used to inject the BuddyPress Backbone views
     * dealing with user's private messages.
     *
     * @since 3.0.0
     * @version 3.1.0
     */
    ?>
    <div class="subnav-filters filters user-subnav bp-messages-filters" id="subsubnav"></div>
    
    <div class="bp-messages-feedback"></div>
    <div class="bp-messages-content"></div>
    
    <script type="text/html" id="tmpl-bp-messages-feedback">
    	<div class="bp-feedback {{data.type}}">
    		<span class="bp-icon" aria-hidden="true"></span>
    		<p>{{{data.message}}}</p>
    	</div>
    </script>
    
    <?php
    /**
     * This view is used to inject hooks buffer
     */
    ?>
    <script type="text/html" id="tmpl-bp-messages-hook">
    	{{{data.extraContent}}}
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-form">
    	<?php bp_nouveau_messages_hook( 'before', 'compose_content' ); ?>
    
    	<label for="send-to-input"><?php esc_html_e( 'Send @Username', 'buddypress' ); ?></label>
    	<input type="text" name="send_to" class="send-to-input" id="send-to-input" />
    
    	<label for="subject"><?php _e( 'Subject', 'buddypress' ); ?></label>
    	<input type="text" name="subject" id="subject"/>
    
    	<div id="bp-message-content"></div>
    
    	<?php bp_nouveau_messages_hook( 'after', 'compose_content' ); ?>
    
    	<div class="submit">
    		<input type="button" id="bp-messages-send" class="button bp-primary-action" value="<?php echo esc_attr_x( 'Send', 'button', 'buddypress' ); ?>"/>
    		<input type="button" id="bp-messages-reset" class="text-button small bp-secondary-action" value="<?php echo esc_attr_x( 'Reset', 'form reset button', 'buddypress' ); ?>"/>
    	</div>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-editor">
    	<?php
    	// Add a temporary filter on editor buttons
    	add_filter( 'mce_buttons', 'bp_nouveau_messages_mce_buttons', 10, 1 );
    
    	wp_editor(
    		'',
    		'message_content',
    		array(
    			'textarea_name' => 'message_content',
    			'teeny'         => false,
    			'media_buttons' => false,
    			'dfw'           => false,
    			'tinymce'       => true,
    			'quicktags'     => false,
    			'tabindex'      => '3',
    			'textarea_rows' => 5,
    		)
    	);
    
    	// Remove the temporary filter on editor buttons
    	remove_filter( 'mce_buttons', 'bp_nouveau_messages_mce_buttons', 10, 1 );
    	?>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-paginate">
    	<# if ( 1 !== data.page ) { #>
    		<button id="bp-messages-prev-page"class="button messages-button">
    			<span class="dashicons dashicons-arrow-left"></span>
    			<span class="bp-screen-reader-text"><?php echo esc_html_x( 'Previous page', 'link', 'buddypress' ); ?></span>
    		</button>
    	<# } #>
    
    	<# if ( data.total_page !== data.page ) { #>
    		<button id="bp-messages-next-page"class="button messages-button">
    			<span class="dashicons dashicons-arrow-right"></span>
    			<span class="bp-screen-reader-text"><?php echo esc_html_x( 'Next page', 'link', 'buddypress' ); ?></span>
    		</button>
    	<# } #>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-filters">
    	<li class="user-messages-search" role="search" data-bp-search="{{data.box}}">
    		<div class="bp-search messages-search">
    			<?php bp_nouveau_message_search_form(); ?>
    		</div>
    	</li>
    	<li class="user-messages-bulk-actions"></li>
    </script>
    
    <script type="text/html" id="tmpl-bp-bulk-actions">
    	<input type="checkbox" id="user_messages_select_all" value="1"/>
    	<label for="user_messages_select_all"><?php esc_html_e( 'All Messages', 'buddypress' ); ?></label>
    	<div class="bulk-actions-wrap bp-hide">
    		<div class="bulk-actions select-wrap">
    			<label for="user-messages-bulk-actions" class="bp-screen-reader-text">
    				<?php esc_html_e( 'Select bulk action', 'buddypress' ); ?>
    			</label>
    			<select id="user-messages-bulk-actions">
    				<# for ( i in data ) { #>
    					<option value="{{data[i].value}}">{{data[i].label}}</option>
    				<# } #>
    			</select>
    			<span class="select-arrow" aria-hidden="true"></span>
    		</div>
    		<button class="messages-button bulk-apply bp-tooltip" type="submit" data-bp-tooltip="<?php echo esc_attr_x( 'Apply', 'button', 'buddypress' ); ?>">
    			<span class="dashicons dashicons-yes" aria-hidden="true"></span>
    			<span class="bp-screen-reader-text"><?php echo esc_html_x( 'Apply', 'button', 'buddypress' ); ?></span>
    		</button>
    	</div>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-thread">
    	<div class="thread-cb">
    		<input class="message-check" type="checkbox" name="message_ids[]" id="bp-message-thread-{{data.id}}" value="{{data.id}}">
    		<label for="bp-message-thread-{{data.id}}" class="bp-screen-reader-text"><?php esc_html_e( 'Select message:', 'buddypress' ); ?> {{data.subject}}</label>
    	</div>
    
    	<# if ( ! data.recipientsCount ) { #>
    		<div class="thread-from">
    			<a class="user-link" href="{{data.sender_link}}">
    				<img class="avatar" src="{{data.sender_avatar}}" alt="" />
    				<span class="bp-screen-reader-text"><?php esc_html_e( 'From:', 'buddypress' ); ?></span>
    				<span class="user-name">{{data.sender_name}}</span>
    			</a>
    		</div>
    	<# } else {
    		var recipient = _.first( data.recipients );
    		#>
    		<div class="thread-to">
    			<a class="user-link" href="{{recipient.user_link}}">
    				<img class="avatar" src="{{recipient.avatar}}" alt="" />
    				<span class="bp-screen-reader-text"><?php esc_html_e( 'To:', 'buddypress' ); ?></span>
    				<span class="user-name">{{recipient.user_name}}</span>
    			</a>
    
    			<# if ( data.toOthers ) { #>
    				<span class="num-recipients">{{data.toOthers}}</span>
    			<# } #>
    		</div>
    	<# } #>
    
    	<div class="thread-content" data-thread-id="{{data.id}}">
    		<div class="thread-subject">
    			<span class="thread-count">({{data.count}})</span>
    			<a class="subject" href="../view/{{data.id}}/">{{data.subject}}</a>
    		</div>
    		<p class="excerpt">{{data.excerpt}}</p>
    	</div>
    	<div class="thread-date">
    		<time datetime="{{data.date.toISOString()}}">{{data.display_date}}</time>
    	</div>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-preview">
    	<# if ( undefined !== data.content ) { #>
    
    		<h2 class="message-title preview-thread-title"><?php esc_html_e( 'Active conversation:', 'buddypress' ); ?><span class="messages-title">{{{data.subject}}}</span></h2>
    		<div class="preview-content">
    			<header class="preview-pane-header">
    
    				<# if ( undefined !== data.recipients ) { #>
    					<dl class="thread-participants">
    						<dt><?php esc_html_e( 'Participants:', 'buddypress' ); ?></dt>
    						<dd>
    							<ul class="participants-list">
    								<# for ( i in data.recipients ) { #>
    									<li><a href="{{data.recipients[i].user_link}}" class="bp-tooltip" data-bp-tooltip="{{data.recipients[i].user_name}}"><img class="avatar mini" src="{{data.recipients[i].avatar}}" alt="{{data.recipients[i].user_name}}" /></a></li>
    								<# } #>
    							</ul>
    						</dd>
    					</dl>
    				<# } #>
    
    				<div class="actions">
    
    					<button type="button" class="message-action-delete bp-tooltip bp-icons" data-bp-action="delete" data-bp-tooltip="<?php esc_attr_e( 'Delete conversation.', 'buddypress' ); ?>">
    						<span class="bp-screen-reader-text"><?php esc_html_e( 'Delete conversation.', 'buddypress' ); ?></span>
    					</button>
    
    					<# if ( undefined !== data.star_link ) { #>
    
    						<# if ( false !== data.is_starred ) { #>
    							<a role="button" class="message-action-unstar bp-tooltip bp-icons" href="{{data.star_link}}" data-bp-action="unstar" aria-pressed="true" data-bp-tooltip="<?php esc_attr_e( 'Unstar Conversation', 'buddypress' ); ?>">
    								<span class="bp-screen-reader-text"><?php esc_html_e( 'Unstar Conversation', 'buddypress' ); ?></span>
    							</a>
    						<# } else { #>
    							<a role="button" class="message-action-star bp-tooltip bp-icons" href="{{data.star_link}}" data-bp-action="star" aria-pressed="false" data-bp-tooltip="<?php esc_attr_e( 'Star Conversation', 'buddypress' ); ?>">
    								<span class="bp-screen-reader-text"><?php esc_html_e( 'Star Conversation', 'buddypress' ); ?></span>
    							</a>
    						<# } #>
    
    					<# } #>
    
    					<a href="../view/{{data.id}}/" class="message-action-view bp-tooltip bp-icons" data-bp-action="view" data-bp-tooltip="<?php esc_attr_e( 'View full conversation and reply.', 'buddypress' ); ?>">
    						<span class="bp-screen-reader-text"><?php esc_html_e( 'View full conversation and reply.', 'buddypress' ); ?></span>
    					</a>
    
    					<# if ( data.threadOptions ) { #>
    						<span class="bp-messages-hook thread-options">
    							{{{data.threadOptions}}}
    						</span>
    					<# } #>
    				</div>
    			</header>
    
    			<div class='preview-message'>
    				{{{data.content}}}
    			</div>
    
    			<# if ( data.inboxListItem ) { #>
    				<table class="bp-messages-hook inbox-list-item">
    					<tbody>
    						<tr>{{{data.inboxListItem}}}</tr>
    					</tbody>
    				</table>
    			<# } #>
    		</div>
    	<# } #>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-single-header">
    	<h2 id="message-subject" class="message-title single-thread-title">{{{data.subject}}}</h2>
    	<header class="single-message-thread-header">
    		<# if ( undefined !== data.recipients ) { #>
    			<dl class="thread-participants">
    				<dt><?php esc_html_e( 'Participants:', 'buddypress' ); ?></dt>
    				<dd>
    					<ul class="participants-list">
    						<# for ( i in data.recipients ) { #>
    							<li><a href="{{data.recipients[i].user_link}}" class="bp-tooltip" data-bp-tooltip="{{data.recipients[i].user_name}}"><img class="avatar mini" src="{{data.recipients[i].avatar}}" alt="{{data.recipients[i].user_name}}" /></a></li>
    						<# } #>
    					</ul>
    				</dd>
    			</dl>
    		<# } #>
    
    		<?php if(current_user_can('manage_options')){ ?>
    			<button type="button" class="message-action-delete bp-tooltip bp-icons" data-bp-action="delete" data-bp-tooltip="<?php esc_attr_e( 'Delete conversation.', 'buddypress' ); ?>">
    				<span class="bp-screen-reader-text"><?php esc_html_e( 'Delete conversation.', 'buddypress' ); ?></span>
    			</button>
    		<?php }?>
    		</div>
    	</header>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-single-list">
    	<div class="message-metadata">
    		<# if ( data.beforeMeta ) { #>
    			<div class="bp-messages-hook before-message-meta">{{{data.beforeMeta}}}</div>
    		<# } #>
    
    		<a href="{{data.sender_link}}" class="user-link">
    			<img class="avatar" src="{{data.sender_avatar}}" alt="" />
    			<strong>{{data.sender_name}}</strong>
    		</a>
    
    		<time datetime="{{data.date.toISOString()}}" class="activity">{{data.display_date}}</time>
    
    		<div class="actions">
    			<# if ( undefined !== data.star_link ) { #>
    
    				<button type="button" class="message-action-unstar bp-tooltip bp-icons <# if ( false === data.is_starred ) { #>bp-hide<# } #>" data-bp-star-link="{{data.star_link}}" data-bp-action="unstar" data-bp-tooltip="<?php esc_attr_e( 'Unstar Message', 'buddypress' ); ?>">
    					<span class="bp-screen-reader-text"><?php esc_html_e( 'Unstar Message', 'buddypress' ); ?></span>
    				</button>
    
    				<button type="button" class="message-action-star bp-tooltip bp-icons <# if ( false !== data.is_starred ) { #>bp-hide<# } #>" data-bp-star-link="{{data.star_link}}" data-bp-action="star" data-bp-tooltip="<?php esc_attr_e( 'Star Message', 'buddypress' ); ?>">
    					<span class="bp-screen-reader-text"><?php esc_html_e( 'Star Message', 'buddypress' ); ?></span>
    				</button>
    
    			<# } #>
    		</div>
    
    		<# if ( data.afterMeta ) { #>
    			<div class="bp-messages-hook after-message-meta">{{{data.afterMeta}}}</div>
    		<# } #>
    	</div>
    
    	<# if ( data.beforeContent ) { #>
    		<div class="bp-messages-hook before-message-content">{{{data.beforeContent}}}</div>
    	<# } #>
    
    	<div class="message-content">{{{data.content}}}</div>
    
    	<# if ( data.afterContent ) { #>
    		<div class="bp-messages-hook after-message-content">{{{data.afterContent}}}</div>
    	<# } #>
    
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-single">
    	<?php bp_nouveau_messages_hook( 'before', 'thread_content' ); ?>
    
    	<div id="bp-message-thread-header" class="message-thread-header"></div>
    
    	<?php bp_nouveau_messages_hook( 'before', 'thread_list' ); ?>
    
    	<ul id="bp-message-thread-list"></ul>
    
    	<?php bp_nouveau_messages_hook( 'after', 'thread_list' ); ?>
    
    	<?php bp_nouveau_messages_hook( 'before', 'thread_reply' ); ?>
    
    	<form id="send-reply" class="standard-form send-reply">
    		<div class="message-box">
    			<div class="message-metadata">
    
    				<?php bp_nouveau_messages_hook( 'before', 'reply_meta' ); ?>
    
    				<div class="avatar-box">
    					<?php bp_loggedin_user_avatar( 'type=thumb&height=30&width=30' ); ?>
    
    					<strong><?php esc_html_e( 'Send a Reply', 'buddypress' ); ?></strong>
    				</div>
    
    				<?php bp_nouveau_messages_hook( 'after', 'reply_meta' ); ?>
    
    			</div><!-- .message-metadata -->
    
    			<div class="message-content">
    
    				<?php bp_nouveau_messages_hook( 'before', 'reply_box' ); ?>
    
    				<label for="message_content" class="bp-screen-reader-text"><?php _e( 'Reply to Message', 'buddypress' ); ?></label>
    				<div id="bp-message-content"></div>
    
    				<?php bp_nouveau_messages_hook( 'after', 'reply_box' ); ?>
    
    				<div class="submit">
    					<input type="submit" name="send" value="<?php echo esc_attr_x( 'Send Reply', 'button', 'buddypress' ); ?>" id="send_reply_button"/>
    				</div>
    
    			</div><!-- .message-content -->
    
    		</div><!-- .message-box -->
    	</form>
    
    	<?php bp_nouveau_messages_hook( 'after', 'thread_reply' ); ?>
    
    	<?php bp_nouveau_messages_hook( 'after', 'thread_content' ); ?>
    </script>
    

    Thanks


    Prashant Singh
    Participant

    @prashantvatsh

    <?php
    /**
     * BP Nouveau Messages main template.
     *
     * This template is used to inject the BuddyPress Backbone views
     * dealing with user's private messages.
     *
     * @since 3.0.0
     * @version 3.1.0
     */
    ?>
    <div class="subnav-filters filters user-subnav bp-messages-filters" id="subsubnav"></div>
    
    <div class="bp-messages-feedback"></div>
    <div class="bp-messages-content"></div>
    
    <script type="text/html" id="tmpl-bp-messages-feedback">
    	<div class="bp-feedback {{data.type}}">
    		<span class="bp-icon" aria-hidden="true"></span>
    		<p>{{{data.message}}}</p>
    	</div>
    </script>
    
    <?php
    /**
     * This view is used to inject hooks buffer
     */
    ?>
    <script type="text/html" id="tmpl-bp-messages-hook">
    	{{{data.extraContent}}}
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-form">
    	<?php bp_nouveau_messages_hook( 'before', 'compose_content' ); ?>
    
    	<label for="send-to-input"><?php esc_html_e( 'Send @Username', 'buddypress' ); ?></label>
    	<input type="text" name="send_to" class="send-to-input" id="send-to-input" />
    
    	<label for="subject"><?php _e( 'Subject', 'buddypress' ); ?></label>
    	<input type="text" name="subject" id="subject"/>
    
    	<div id="bp-message-content"></div>
    
    	<?php bp_nouveau_messages_hook( 'after', 'compose_content' ); ?>
    
    	<div class="submit">
    		<input type="button" id="bp-messages-send" class="button bp-primary-action" value="<?php echo esc_attr_x( 'Send', 'button', 'buddypress' ); ?>"/>
    		<input type="button" id="bp-messages-reset" class="text-button small bp-secondary-action" value="<?php echo esc_attr_x( 'Reset', 'form reset button', 'buddypress' ); ?>"/>
    	</div>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-editor">
    	<?php
    	// Add a temporary filter on editor buttons
    	add_filter( 'mce_buttons', 'bp_nouveau_messages_mce_buttons', 10, 1 );
    
    	wp_editor(
    		'',
    		'message_content',
    		array(
    			'textarea_name' => 'message_content',
    			'teeny'         => false,
    			'media_buttons' => false,
    			'dfw'           => false,
    			'tinymce'       => true,
    			'quicktags'     => false,
    			'tabindex'      => '3',
    			'textarea_rows' => 5,
    		)
    	);
    
    	// Remove the temporary filter on editor buttons
    	remove_filter( 'mce_buttons', 'bp_nouveau_messages_mce_buttons', 10, 1 );
    	?>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-paginate">
    	<# if ( 1 !== data.page ) { #>
    		<button id="bp-messages-prev-page"class="button messages-button">
    			<span class="dashicons dashicons-arrow-left"></span>
    			<span class="bp-screen-reader-text"><?php echo esc_html_x( 'Previous page', 'link', 'buddypress' ); ?></span>
    		</button>
    	<# } #>
    
    	<# if ( data.total_page !== data.page ) { #>
    		<button id="bp-messages-next-page"class="button messages-button">
    			<span class="dashicons dashicons-arrow-right"></span>
    			<span class="bp-screen-reader-text"><?php echo esc_html_x( 'Next page', 'link', 'buddypress' ); ?></span>
    		</button>
    	<# } #>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-filters">
    	<li class="user-messages-search" role="search" data-bp-search="{{data.box}}">
    		<div class="bp-search messages-search">
    			<?php bp_nouveau_message_search_form(); ?>
    		</div>
    	</li>
    	<li class="user-messages-bulk-actions"></li>
    </script>
    
    <script type="text/html" id="tmpl-bp-bulk-actions">
    	<input type="checkbox" id="user_messages_select_all" value="1"/>
    	<label for="user_messages_select_all"><?php esc_html_e( 'All Messages', 'buddypress' ); ?></label>
    	<div class="bulk-actions-wrap bp-hide">
    		<div class="bulk-actions select-wrap">
    			<label for="user-messages-bulk-actions" class="bp-screen-reader-text">
    				<?php esc_html_e( 'Select bulk action', 'buddypress' ); ?>
    			</label>
    			<select id="user-messages-bulk-actions">
    				<# for ( i in data ) { #>
    					<option value="{{data[i].value}}">{{data[i].label}}</option>
    				<# } #>
    			</select>
    			<span class="select-arrow" aria-hidden="true"></span>
    		</div>
    		<button class="messages-button bulk-apply bp-tooltip" type="submit" data-bp-tooltip="<?php echo esc_attr_x( 'Apply', 'button', 'buddypress' ); ?>">
    			<span class="dashicons dashicons-yes" aria-hidden="true"></span>
    			<span class="bp-screen-reader-text"><?php echo esc_html_x( 'Apply', 'button', 'buddypress' ); ?></span>
    		</button>
    	</div>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-thread">
    	<div class="thread-cb">
    		<input class="message-check" type="checkbox" name="message_ids[]" id="bp-message-thread-{{data.id}}" value="{{data.id}}">
    		<label for="bp-message-thread-{{data.id}}" class="bp-screen-reader-text"><?php esc_html_e( 'Select message:', 'buddypress' ); ?> {{data.subject}}</label>
    	</div>
    
    	<# if ( ! data.recipientsCount ) { #>
    		<div class="thread-from">
    			<a class="user-link" href="{{data.sender_link}}">
    				<img class="avatar" src="{{data.sender_avatar}}" alt="" />
    				<span class="bp-screen-reader-text"><?php esc_html_e( 'From:', 'buddypress' ); ?></span>
    				<span class="user-name">{{data.sender_name}}</span>
    			</a>
    		</div>
    	<# } else {
    		var recipient = _.first( data.recipients );
    		#>
    		<div class="thread-to">
    			<a class="user-link" href="{{recipient.user_link}}">
    				<img class="avatar" src="{{recipient.avatar}}" alt="" />
    				<span class="bp-screen-reader-text"><?php esc_html_e( 'To:', 'buddypress' ); ?></span>
    				<span class="user-name">{{recipient.user_name}}</span>
    			</a>
    
    			<# if ( data.toOthers ) { #>
    				<span class="num-recipients">{{data.toOthers}}</span>
    			<# } #>
    		</div>
    	<# } #>
    
    	<div class="thread-content" data-thread-id="{{data.id}}">
    		<div class="thread-subject">
    			<span class="thread-count">({{data.count}})</span>
    			<a class="subject" href="../view/{{data.id}}/">{{data.subject}}</a>
    		</div>
    		<p class="excerpt">{{data.excerpt}}</p>
    	</div>
    	<div class="thread-date">
    		<time datetime="{{data.date.toISOString()}}">{{data.display_date}}</time>
    	</div>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-preview">
    	<# if ( undefined !== data.content ) { #>
    
    		<h2 class="message-title preview-thread-title"><?php esc_html_e( 'Active conversation:', 'buddypress' ); ?><span class="messages-title">{{{data.subject}}}</span></h2>
    		<div class="preview-content">
    			<header class="preview-pane-header">
    
    				<# if ( undefined !== data.recipients ) { #>
    					<dl class="thread-participants">
    						<dt><?php esc_html_e( 'Participants:', 'buddypress' ); ?></dt>
    						<dd>
    							<ul class="participants-list">
    								<# for ( i in data.recipients ) { #>
    									<li><a href="{{data.recipients[i].user_link}}" class="bp-tooltip" data-bp-tooltip="{{data.recipients[i].user_name}}"><img class="avatar mini" src="{{data.recipients[i].avatar}}" alt="{{data.recipients[i].user_name}}" /></a></li>
    								<# } #>
    							</ul>
    						</dd>
    					</dl>
    				<# } #>
    
    				<div class="actions">
    					<?php if(current_user_can('manage_options')){ ?>
    
    					<button type="button" class="message-action-delete bp-tooltip bp-icons" data-bp-action="delete" data-bp-tooltip="<?php esc_attr_e( 'Delete conversation.', 'buddypress' ); ?>">
    						<span class="bp-screen-reader-text"><?php esc_html_e( 'Delete conversation.', 'buddypress' ); ?></span>
    					</button>
    				<?php }?>
    
    					<# if ( undefined !== data.star_link ) { #>
    
    						<# if ( false !== data.is_starred ) { #>
    							<a role="button" class="message-action-unstar bp-tooltip bp-icons" href="{{data.star_link}}" data-bp-action="unstar" aria-pressed="true" data-bp-tooltip="<?php esc_attr_e( 'Unstar Conversation', 'buddypress' ); ?>">
    								<span class="bp-screen-reader-text"><?php esc_html_e( 'Unstar Conversation', 'buddypress' ); ?></span>
    							</a>
    						<# } else { #>
    							<a role="button" class="message-action-star bp-tooltip bp-icons" href="{{data.star_link}}" data-bp-action="star" aria-pressed="false" data-bp-tooltip="<?php esc_attr_e( 'Star Conversation', 'buddypress' ); ?>">
    								<span class="bp-screen-reader-text"><?php esc_html_e( 'Star Conversation', 'buddypress' ); ?></span>
    							</a>
    						<# } #>
    
    					<# } #>
    
    					<a href="../view/{{data.id}}/" class="message-action-view bp-tooltip bp-icons" data-bp-action="view" data-bp-tooltip="<?php esc_attr_e( 'View full conversation and reply.', 'buddypress' ); ?>">
    						<span class="bp-screen-reader-text"><?php esc_html_e( 'View full conversation and reply.', 'buddypress' ); ?></span>
    					</a>
    
    					<# if ( data.threadOptions ) { #>
    						<span class="bp-messages-hook thread-options">
    							{{{data.threadOptions}}}
    						</span>
    					<# } #>
    				</div>
    			</header>
    
    			<div class='preview-message'>
    				{{{data.content}}}
    			</div>
    
    			<# if ( data.inboxListItem ) { #>
    				<table class="bp-messages-hook inbox-list-item">
    					<tbody>
    						<tr>{{{data.inboxListItem}}}</tr>
    					</tbody>
    				</table>
    			<# } #>
    		</div>
    	<# } #>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-single-header">
    	<h2 id="message-subject" class="message-title single-thread-title">{{{data.subject}}}</h2>
    	<header class="single-message-thread-header">
    		<# if ( undefined !== data.recipients ) { #>
    			<dl class="thread-participants">
    				<dt><?php esc_html_e( 'Participants:', 'buddypress' ); ?></dt>
    				<dd>
    					<ul class="participants-list">
    						<# for ( i in data.recipients ) { #>
    							<li><a href="{{data.recipients[i].user_link}}" class="bp-tooltip" data-bp-tooltip="{{data.recipients[i].user_name}}"><img class="avatar mini" src="{{data.recipients[i].avatar}}" alt="{{data.recipients[i].user_name}}" /></a></li>
    						<# } #>
    					</ul>
    				</dd>
    			</dl>
    		<# } #>
    
    		<div class="actions">
    					<?php if(current_user_can('manage_options')){ ?>
    
    			<button type="button" class="message-action-delete bp-tooltip bp-icons" data-bp-action="delete" data-bp-tooltip="<?php esc_attr_e( 'Delete conversation.', 'buddypress' ); ?>">
    				<span class="bp-screen-reader-text"><?php esc_html_e( 'Delete conversation.', 'buddypress' ); ?></span>
    			</button>
    <?php }?>
    		</div>
    	</header>
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-single-list">
    	<div class="message-metadata">
    		<# if ( data.beforeMeta ) { #>
    			<div class="bp-messages-hook before-message-meta">{{{data.beforeMeta}}}</div>
    		<# } #>
    
    		<a href="{{data.sender_link}}" class="user-link">
    			<img class="avatar" src="{{data.sender_avatar}}" alt="" />
    			<strong>{{data.sender_name}}</strong>
    		</a>
    
    		<time datetime="{{data.date.toISOString()}}" class="activity">{{data.display_date}}</time>
    
    		<div class="actions">
    			<# if ( undefined !== data.star_link ) { #>
    
    				<button type="button" class="message-action-unstar bp-tooltip bp-icons <# if ( false === data.is_starred ) { #>bp-hide<# } #>" data-bp-star-link="{{data.star_link}}" data-bp-action="unstar" data-bp-tooltip="<?php esc_attr_e( 'Unstar Message', 'buddypress' ); ?>">
    					<span class="bp-screen-reader-text"><?php esc_html_e( 'Unstar Message', 'buddypress' ); ?></span>
    				</button>
    
    				<button type="button" class="message-action-star bp-tooltip bp-icons <# if ( false !== data.is_starred ) { #>bp-hide<# } #>" data-bp-star-link="{{data.star_link}}" data-bp-action="star" data-bp-tooltip="<?php esc_attr_e( 'Star Message', 'buddypress' ); ?>">
    					<span class="bp-screen-reader-text"><?php esc_html_e( 'Star Message', 'buddypress' ); ?></span>
    				</button>
    
    			<# } #>
    		</div>
    
    		<# if ( data.afterMeta ) { #>
    			<div class="bp-messages-hook after-message-meta">{{{data.afterMeta}}}</div>
    		<# } #>
    	</div>
    
    	<# if ( data.beforeContent ) { #>
    		<div class="bp-messages-hook before-message-content">{{{data.beforeContent}}}</div>
    	<# } #>
    
    	<div class="message-content">{{{data.content}}}</div>
    
    	<# if ( data.afterContent ) { #>
    		<div class="bp-messages-hook after-message-content">{{{data.afterContent}}}</div>
    	<# } #>
    
    </script>
    
    <script type="text/html" id="tmpl-bp-messages-single">
    	<?php bp_nouveau_messages_hook( 'before', 'thread_content' ); ?>
    
    	<div id="bp-message-thread-header" class="message-thread-header"></div>
    
    	<?php bp_nouveau_messages_hook( 'before', 'thread_list' ); ?>
    
    	<ul id="bp-message-thread-list"></ul>
    
    	<?php bp_nouveau_messages_hook( 'after', 'thread_list' ); ?>
    
    	<?php bp_nouveau_messages_hook( 'before', 'thread_reply' ); ?>
    
    	<form id="send-reply" class="standard-form send-reply">
    		<div class="message-box">
    			<div class="message-metadata">
    
    				<?php bp_nouveau_messages_hook( 'before', 'reply_meta' ); ?>
    
    				<div class="avatar-box">
    					<?php bp_loggedin_user_avatar( 'type=thumb&height=30&width=30' ); ?>
    
    					<strong><?php esc_html_e( 'Send a Reply', 'buddypress' ); ?></strong>
    				</div>
    
    				<?php bp_nouveau_messages_hook( 'after', 'reply_meta' ); ?>
    
    			</div><!-- .message-metadata -->
    
    			<div class="message-content">
    
    				<?php bp_nouveau_messages_hook( 'before', 'reply_box' ); ?>
    
    				<label for="message_content" class="bp-screen-reader-text"><?php _e( 'Reply to Message', 'buddypress' ); ?></label>
    				<div id="bp-message-content"></div>
    
    				<?php bp_nouveau_messages_hook( 'after', 'reply_box' ); ?>
    
    				<div class="submit">
    					<input type="submit" name="send" value="<?php echo esc_attr_x( 'Send Reply', 'button', 'buddypress' ); ?>" id="send_reply_button"/>
    				</div>
    
    			</div><!-- .message-content -->
    
    		</div><!-- .message-box -->
    	</form>
    
    	<?php bp_nouveau_messages_hook( 'after', 'thread_reply' ); ?>
    
    	<?php bp_nouveau_messages_hook( 'after', 'thread_content' ); ?>
    </script>

    Please use this file.

    Thanks


    Anonymous User 16484011
    Inactive

    @anonymized-16484011

    Hi !

    Prashant,

    Thanks for your valuable time but above code didn’t work me. Please see below what I do or what mistakes I do while using your code OR anything else I forgot to add in above code file.

    I do below with your code ….

    I just logged in to my cpenl -> go to File Manager -> open index.php file

    I just copy your above code to index.php file in folder of /harihealthcare.ml/htdocs/wp-content/plugins/buddypress/bp-templates/bp-nouveau/buddypress/common/js-templates/messages.

    After saving file. I logged in as Admin role, refresh page of compose message and send demo message and after sent the delete button show and when I click it’s delete

    After I logged in as a Patient role, refresh page of compose message and send demo message and after sent the delete button show and when I click it’s delete

    After logged in as Doctor role, refresh page of compose message and send demo message and after sent the delete button show and when I click it’s delete

    Kindly look into and tell me what I do mistake or you need any further or more details to solve this.

    Regards


    Prashant Singh
    Participant

    @prashantvatsh

    Please send the screenshot or a screencast showing the process


    Prashant Singh
    Participant

    @prashantvatsh

    Any update here?


    Anonymous User 16484011
    Inactive

    @anonymized-16484011

    Oh !

    Where is my answer ? I paste here a link for you on 1 days ago after immediately your answer for upload screenshots. I also remember that I after clicking on submit I also review a answer and I still waiting for your answer but suddenly after your mail that any update I re login to here and see that my previous answer with link is not here…

    Sorry for this ? I still don’t what happens and you and I both waiting for answers … !!!

    Anyway I re upload the file on file.io and here is the steps link. I do this steps screenshot using windows 10 step recorder tool. Please find the steps.zip file.

    LInk : file.io

    Thanks


    Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    It is showing file not found. Please use this https://screencast-o-matic.com/ to create the video.

    Thanks


    Anonymous User 16484011
    Inactive

    @anonymized-16484011

    Hi !

    As you can see in the below video. I logged already into my c penal and reached the path of index file as you guide me in your previous answer. I copy and paste your code and save the file. After saving I go to my site’s patient role logged in user’s buddy press message page and refresh the page but the delete button can’t go. It’s already shown by the user and it’s delete the message.

    Link of recorded Video : LINK

    Thanks


    Prashant Singh
    Participant

    @prashantvatsh

    Please use screencast-o-matic, I am not able to see the video at all.


    Anonymous User 16484011
    Inactive

    @anonymized-16484011

    Actually my mcafee antivirus shows me virus on screencast-o-matic’s downloaded file WebLaunchRecorder.exe that’s why I use camstudio freeware for screen recording. But anyway I turn off my antivirus and sent you the link. Below it is ….

    As you can see in the below video. I logged already into my c penal and reached the path of index file as you guide me in your previous answer. I copy and paste your code and save the file. After saving I go to my site’s patient role logged in user’s buddy press message page and refresh the page but the delete button can’t go. It’s already shown by the user and it’s delete the message.

    Video Link : LINK

    Regards


    Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    After seeing the video it seems like you are getting that link from this file: buddypress\bp-themes\bp-default\members\single\messages\single.php and code is <a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>" title="<?php esc_attr_e( "Delete Message", "buddypress" ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a> &nbsp;

    Also please let me know which template you are using?

    Thanks


    Anonymous User 16484011
    Inactive

    @anonymized-16484011

    I am not using any buddy press template I use Youzer plugin. I think this plugin gives me this template. as you can see in the video path.

    By the way …

    1. I can’t understand your above answer.

    2. What can I do wrong in the video ?

    3. What can I do now for preventing users other than admin to delete the private conversation.

    4. Can I put your above code in plugin’s directory’s path “\wp-content\plugins\youzer\includes\public\templates\members\single\messages” single.php file ?

    5. Is any other way or plugin to prevent users other than admin to delete private message ?

    Thanks


    Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    That is a paid plugin so I do not have access to the code.

    Can I put your above code in plugin’s directory’s path “\wp-content\plugins\youzer\includes\public\templates\members\single\messages” single.php file ?

    If the file is there then try to find this code <a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>" title="<?php esc_attr_e( "Delete Message", "buddypress" ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>

    and then replace it with this code:

    <?php if(current_user_can('manage_options')){?>
    <a>" title="<?php esc_attr_e( "Delete Message", "buddypress" ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>
    <?php }?>

    Thanks


    Anonymous User 16484011
    Inactive

    @anonymized-16484011

    Hi !

    Prashant,

    As per your above suggestion, I find the above code but as I find it’s not exact as you wrote above. But I replace as per my poor coding knowledge but it’s not work.

    Here is the code of single.php file from location
    “wp-content\plugins\youzer\includes\public\templates\members\single\messages”

    <?php
    /**
     * BuddyPress - Members Single Message
     */
    
    ?>
    <div id="message-thread">
    
    	<?php
    
    	/**
    	 * Fires before the display of a single member message thread content.
    	 *
    	 * @since 1.1.0
    	 */
    	do_action( 'bp_before_message_thread_content' ); ?>
    
    	<?php if ( bp_thread_has_messages() ) : ?>
    
    		<div id="message-recipients">
    
    			<div class="highlight-icon"><i class="far fa-comments"></i></div>
    			
    			<div class="highlight">
    
    				<h2 id="message-subject"><?php bp_the_thread_subject(); ?></h2>
    				
    				<span class="highlight-meta">
    					
    				<?php if ( bp_get_thread_recipients_count() <= 1 ) : ?>
    
    					<?php _e( 'You are alone in this conversation.', 'youzer' ); ?>
    
    				<?php elseif ( bp_get_max_thread_recipients_to_list() <= bp_get_thread_recipients_count() ) : ?>
    
    					<?php printf( __( 'Conversation between %s recipients.', 'youzer' ), number_format_i18n( bp_get_thread_recipients_count() ) ); ?>
    
    				<?php else : ?>
    
    					<?php printf( __( 'Conversation between %s.', 'youzer' ), bp_get_thread_recipients_list() ); ?>
    
    				<?php endif; ?>
    
    				</span>
    
    			</div>
    			<div class="highlight-button">
    				
    			<a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>"><i class="fas fa-trash-alt"></i><?php _e( 'Delete', 'youzer' ); ?></a>
    
    			</div>
    			<?php
    
    			/**
    			 * Fires after the action links in the header of a single message thread.
    			 *
    			 * @since 2.5.0
    			 */
    			do_action( 'bp_after_message_thread_recipients' ); ?>
    		</div>
    
    		<?php
    
    		/**
    		 * Fires before the display of the message thread list.
    		 *
    		 * @since 1.1.0
    		 */
    		do_action( 'bp_before_message_thread_list' ); ?>
    
    		<?php while ( bp_thread_messages() ) : bp_thread_the_message(); ?>
    			<?php bp_get_template_part( 'members/single/messages/message' ); ?>
    		<?php endwhile; ?>
    
    		<?php
    
    		/**
    		 * Fires after the display of the message thread list.
    		 *
    		 * @since 1.1.0
    		 */
    		do_action( 'bp_after_message_thread_list' ); ?>
    
    		<?php
    
    		/**
    		 * Fires before the display of the message thread reply form.
    		 *
    		 * @since 1.1.0
    		 */
    		do_action( 'bp_before_message_thread_reply' ); ?>
    
    		<form id="send-reply" action="<?php bp_messages_form_action(); ?>" method="post" class="standard-form">
    
    			<div class="message-reply-content">
    				
    				<?php bp_loggedin_user_avatar( 'type=thumb&height=50&width=50' ); ?>
    
    				<?php
    
    				/**
    				 * Fires before the display of the message reply box.
    				 *
    				 * @since 1.1.0
    				 */
    				do_action( 'bp_before_message_reply_box' ); ?>
    
    				<textarea name="content" id="message_content" rows="15" cols="40" placeholder="<?php _e( 'Write a reply ...', 'youzer' ); ?>"></textarea>
    
    				<?php
    
    				/**
    				 * Fires after the display of the message reply box.
    				 *
    				 * @since 1.1.0
    				 */
    				do_action( 'bp_after_message_reply_box' ); ?>
    			
    			</div>
    
    			<div class="submit">
    				<button type="submit" name="send" id="send_reply_button"><i class="fas fa-paper-plane"></i><?php esc_attr_e( 'Send', 'youzer' ); ?></button>
    			</div>
    
    			<input type="hidden" id="thread_id" name="thread_id" value="<?php bp_the_thread_id(); ?>" />
    			<input type="hidden" id="messages_order" name="messages_order" value="<?php bp_thread_messages_order(); ?>" />
    			<?php wp_nonce_field( 'messages_send_message', 'send_message_nonce' ); ?>
    
    		</form><!-- #send-reply -->
    
    		<?php
    
    		/**
    		 * Fires after the display of the message thread reply form.
    		 *
    		 * @since 1.1.0
    		 */
    		do_action( 'bp_after_message_thread_reply' ); ?>
    
    	<?php endif; ?>
    
    	<?php
    
    	/**
    	 * Fires after the display of a single member message thread content.
    	 *
    	 * @since 1.1.0
    	 */
    	do_action( 'bp_after_message_thread_content' ); ?>
    
    </div>
    

    I replace the line no.49 which is

    <a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>"><i class="fas fa-trash-alt"></i><?php _e( 'Delete', 'youzer' ); ?></a>

    with your code

    <?php if(current_user_can('manage_options')){?>
    <a>" title="<?php esc_attr_e( "Delete Message", "buddypress" ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a>
    <?php }?>

    But still not got the solution.

    Regards


    Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    The first thing now we need to do is to check if that box is coming from this file or not. So try writing anything in the file and check if that gets printed on that screen if yes then certainly we are on the right file otherwise have to check which file is that from where that box is coming.

    Thanks


    Anonymous User 16484011
    Inactive

    @anonymized-16484011

    Hello !

    Prashant,

    Thank for your brilliant idea.

    For your above answer strike my mind that If I delete a code lines from single.php file where word “Delete” and I do the same doing below steps.

  • 1. Open single.php file.
  • 2. Search “Delete” word.
  • 3. I found only one line.
  • 4. This line’s number is 49.
  • 5. I wrote same line here before.
  • 6. I delete the whole line which starts from a tag to end of a tag.
  • 7. Wow ! As you can see in the video’s 1:19 second’s red delete button goes.
  • 8. But single conversation delete button / dustbin icon delete button not gone.
  • 9. This dustbin icon button available in users sent,stared and inbox message list.
  • 10. I find “Delete” word in so many files.
  • 11. Finally, I found it on messages-loop.php file in the same directory.
  • 12. I delete the line no. 127 where delete word.
  • 13. The line is below…
  • <a class="delete" href="<?php bp_message_thread_delete_link( bp_displayed_user_id() ); ?>"><span class="dashicons dashicons-trash"></span></a>

  • 14. Finally, it’s gone from everywhere.
  • Thank You Very Much Prashant for your endless help

    Regards


Anonymous User 16484011
Inactive

@anonymized-16484011

Hi !

Prashant,

Sorry for my above exciting reply.

But I have one problem. After deleting those files those lines admin can also not seen the delete buttons.

Now what should I do ?

Regards


Anonymous User 16484011
Inactive

@anonymized-16484011

Hi !

Prashant,

Sorry for my last exciting reply,

But after deleting those lines from those files admin also can not see the delete buttons.

What should I do now ?

Regards


Anonymous User 16484011
Inactive

@anonymized-16484011

Hello !

Prashant,

Sorry for my last exciting reply,

But after deleting those lines from those files admin also can not see the delete buttons.

What should I do now ?

Regards


Anonymous User 16484011
Inactive

@anonymized-16484011

Helloo !

Prashant,

Sorry for my last exciting reply,

But after deleting those lines from those files admin also can not see the delete buttons.

What should I do now ?

Regards


Prashant Singh
Participant

@prashantvatsh

Hi,

You need to wrap those lines in this code <?php if(current_user_can(‘manage_options’)){?> //Your button code goes here <?php }?> and that is the only way you can make that button visible to admins only.

Thanks


Anonymous User 16484011
Inactive

@anonymized-16484011

Hi !

Prashant,

Thanks for this fast answer.

I wrap button code as per your instruction. But I think I am not a good developer so may be I am doing some mistake and output not came proper.

I explain you what I do.

First I open single.php file and went to the line no. 49 where “Delete” word. (Which line I was delete previous). I put your code and try to wrap but delete button goes from admin also and all other roles also. See my warping code below…

Before Wrap Code (Here Delete Button Shows To All)

			
			<div class="highlight-button">
			
			<a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>"><i class="fas fa-trash-alt"></i><?php _e( 'Delete', 'youzer' ); ?></a>
			
			</div>
			

After Wrap Code (Here Delete Button Goes from All User)


			<div class="highlight-button">
			<?php if(current_user_can(‘manage_options’)){?> 
			
			<a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>"><i class="fas fa-trash-alt"></i><?php _e( 'Delete', 'youzer' ); ?></a>
			
			<?php }?> 
			</div>
			

I also add warping before div class

Before Wrap Code (Here Delete Button Shows To All)

			
			<div class="highlight-button">
			
			<a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>"><i class="fas fa-trash-alt"></i><?php _e( 'Delete', 'youzer' ); ?></a>
			
			</div>
			

After Wrap Code (Here Delete Button Goes from All User)


			<?php if(current_user_can(‘manage_options’)){?> 
			<div class="highlight-button">
			
			
			<a class="button confirm" href="<?php bp_the_thread_delete_link(); ?>"><i class="fas fa-trash-alt"></i><?php _e( 'Delete', 'youzer' ); ?></a>
			
			
			</div>
			<?php }?> 
			

So, Please tell me which silly mistake I am doing ?

Before wrapping the button shows to all and after wrapping it’s hide for (gone from) all.
Regards

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