if (isloggedin()) {
if ($_SESSION['user']->getGUID() != $vars['entity']->getGUID()) {
echo "<p class=\"user_menu_block_user\">"
. "<a href=\"" // we want to zap this user fro all our content ;-)
. "{$vars['url']}action/friends/userblock?usertoblock={$vars['entity']->getGUID()}\">"
. elgg_echo("userblock:zaphim")
. "</a></p>";
}
. . .
// and later
$Block = get_metadata_byname($_SESSION['user']->getGUID(), 'BLOCKED');
$Blocked = $Block->value; // bool
if ($Blocked) // we zapped him ?
header("Location: {$CONFIG->url}" ); // do not allow access -> fwd to site home page
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
I didn't get it. What exactly is this supposed to do?
read here for the background -->
http://community.elgg.org/mod/groups/topicposts.php?topic=200333&group_guid=23300
The code posted above is simply a part of the fuller working plugin that has been implemented elsewhere. For obvious reasons I am not able to post the full code here for the public ;-(
For anyone else who's interested.. this piece of code ==>
as any experienced Elgg Developers would already know - is the standard Elgg way to perform a php echo, although the elgg_echo extends php's abilities by hooking into the Elgg language files.
the code stops anyone you block from seeing your content
Dhrup why are you explaining elgg echo anyone who does understand this does not understand code at all so any code above would be pointless to them anyway and they should not be messing around inside the code as they are liable to break their toy
Hmm...
seems that there were some bugs in the original code ;-) MH emailed me about this and so -- debug, debug.. and finally got the pesky bad code.
The harder part was to prevent blocked users from seeing *any content created by the other. Profile viewing and message sending were relatively simpler. After much head scratching and hair pulling - I do believe the solution has presented itself out of the ether.
I will be looking in more details into this to make sure everything will work as intended. The basic design is to check currently logged-in user and page_owner() and if the two users are blocked -- not display content but redirect to the dashboard.
More testing and refining....
Update on my devel - testing :=
2-Way block now works between normal users only and if they were friends before - no more friends ;-)
Admins (the FK admins) are exempt from being blocked and also do not/cannot block users.
Messages between blocked users are 50% working.
Bigger issue -->
After users "A" and "B" are blocked - Neither one should be to able see each others content, pages, blogs, photos, nothing...
I have some Elgg-way ideas on how this can be done.. took me a while to think on this ;-) and I'm quite sure it will work - I have coded about 50% for this and just need to finish the code and test to make sure.
Latest News -->
Blogs Block Works
Files Block Works
Pages Block Works
Photos Block Works
Groups Does Not Work ;-(
i'm trying to add a user block feature on my site so that users can block a user from contacting them. where would i add the code about in order to enable this?
This topic is 2 years old lolz ;-)
@rohunupe99:
There's a plugin that might be useful for you:
http://community.elgg.org/pg/plugins/project/475802/developer/costelloc/messages-controls
It restricts sending messages to friends only. Maybe that will be enough for you already. Otherwise, you might find some inspiration in the plugin code at least.
- Previous
- 1
- 2
- Next
You must log in to post replies.