Hi there!
Did not know that PeepSo has block feature, will take a look.
Thanks!
@andrijtkachenko Thank you so much! Just tested the latest Better Messages. Blocking PeepSo members worked right away. 🙂 When viewing message settings ‘Blocked users – This is a list of users that you have blocked. You may unblock them from the blocklist below.’ it says below:
‘You haven’t blocked anyone yet’ even though the current user has blocked a user in PeepSo.
From the PeepSo online users WP-page there is a blocked tab. When accessing it, for each user it shows the following HTML:
<div class="ps-dropdown__menu ps-js-dropdown-menu" style="display: block;">
<a href="#" onclick="ps_member.unblock_user(2, this); return false"><i class="lock"></i><span>Unblock User</span>
</a>
</div>
When placing this HTML on a non PeepSo view (works in PeepSo too) in the DOM, when clicking the link, it unblocks user 2. I mention this to make the process as easy as possible to show list of blocked users followed by the HTML mentioned above working beautifully to unblock that user.
This would complete integration of blocked users.
Warm regards,
Josh
Better Messages blocked users list is only works with Better Messages built-in blocks, you need to disable it in plugin settings.
When it’s disabled, there’s no unblocking from the messages view. Getting the list of blocked users is very easy to retrieve in SQL and unblocking users uses simple HTML:
SELECT blk_blocked_id FROM wp_peepso_blocks WHERE blk_user_id = 1;
#1 being the logged in user
PeepSo makes it very easy to unblock a user even outside of PeepSo view with the following HTML:
<a href="#" onclick="ps_member.unblock_user(2, this); return false"><i class="lock"></i><span>Unblock User</span>
</a>
2 being the user who is currently blocked but will be unblocked on link click. Tested this inside Better Messages when inserting into the DOM.
Retrieving user blocks can be found in:
wp-content/plugins/peepso/classes/blockusers.php on line 77:
public function get_by_user($user_id)
{
if (PeepSo::get_option('user_blocking_enable', 0) === 1) {
global $wpdb;
$sql = "SELECT blk.*, user_login " .
" FROM {$wpdb->prefix}" . self::TABLE . " blk " .
" LEFT JOIN {$wpdb->users} ON ID=blk_user_id " .
" LEFT JOIN {$wpdb->prefix}peepso_users ps ON ps.usr_id=blk.blk_user_id " .
" WHERE blk.blk_user_id=%d ";
$res = $wpdb->get_results($wpdb->prepare($sql, $user_id), OBJECT);
return ($res);
}
}
Warm regards,
Josh
Hi there!
PeepSo block list is not planned to be integrated to Better Messages interface at the moment, please use PeepSo interface to see and unblock blocked users.
Thanks!
Understood. I’m very thankful for the support and integration of PeepSo blocking. Is there a filter for appending a link to Better Message settings? I could link to site/members/blocked. get_conversations_layout is as close as I could find when looking through docs. I’m comfortable writing PHP filters that can append strings to things, writing it in a function, initiating it with WP.