I have had members to accidentally block a member because the block action does not have a confirmation; it posts a notice but it is possible for members to overlook the notice and to accidentally click on the block button; yes, it has happened more than once. I have tried searching the forum for this without a lot of luck, searching on "block" brings up a lot of posts on blocks, not blocking members. I have tried enclosing the key words in quotes without luck. Anyway, what is need is a simple confirmation before blocking the member; it can be done in a javascript alert; "Are you sure you want to block this member?" with a yes and no button. What I need to know, if anyone can help, is where is the code dealing with blocking members so I can add this simple alert notice? Geeks, making the world a better place |
There are several places we have been begging for your exact request.
Like in the compiling of the languages, some have accidentally clicked delete and poof its gone, there is no asking are you sure.
Maybe one day all of the delete features will have this double check option.
ManOfTeal.COM a Proud UNA site, six years running strong! |
I see. Well, I guess we need to just roll up our sleeves and start working on them one by one. Let me see if I can figure out where this is handled for the blocking of members; firebug is my friend. Although it does make upgrading that muck harder. Geeks, making the world a better place |
I forgot I had the Actions Manager Premium by ESASE; I can edit the actions using that module! I think actions are actually stored in the database, correct? Geeks, making the world a better place |
I'm not sure where the actions are stored.
And your much braver than I, I used to do all those, what I thought were cool changes, only to run into massive problems with upgrades and modules. So I stopped doing modding to core files.
ManOfTeal.COM a Proud UNA site, six years running strong! |
OK, this is handled in list_pop.php. Now to modify the code so that it asks if the action should be carried out before it is carried out. Geeks, making the world a better place |
In an active social network, accidentally blocking a friend can cause social strife. Multiple instances of this occurring is prompting this action by me. The problem is that changing core files is usually the only way to fix things. I could put in a support ticket I suppose and hope it is added to the upgrades but I need to do it now. Geeks, making the world a better place |
OK, here we go: the action for "block member" is:
onclick="$.post('list_pop.php?action=block', { ID: '510' }, function(sData){ $('#ajaxy_popup_result_div_510').html(sData) } );return false;">
so what I need to do is to add to the onclick statement: return confirm('Are you sure you want to block this member?') which will return either true or false based on clicking yes or no. Can anyone help with the code here?
Geeks, making the world a better place |
OK, here is the solution. You need to add the bit in red to the actions for the block button.
if ( {ID} == {member_id} || isBlocked({member_id}, {ID}) ) return;
return "if(confirm('Are you sure you want to block this member?')) $.post('list_pop.php?action=block', { ID: '{ID}' }, function(sData){ $('#ajaxy_popup_result_div_{ID}').html(sData) } );return false;";
If you hit Cancel, the action is not taken. If you hit OK, the action is taken and the member is blocked.
Geeks, making the world a better place |
Excellent work..
Hopefully most members will see this post, you should post this in a blog as well.
ManOfTeal.COM a Proud UNA site, six years running strong! |
I can write a blog? I didn't know that. Geeks, making the world a better place |
I can write a blog? I didn't know that.
lmao, your kidding right! you just made me really burst one out.. thanks!
http://www.boonex.com/notes/new
I usually make one when I post in the tips and tricks section. One good thing about the blogs, you can edit for ever..
i.e. http://www.boonex.com/n/faq-for-your-site-2012-01-13-21-00
ManOfTeal.COM a Proud UNA site, six years running strong! |
Here is the funny part; when you go to unblock someone, they have a "Are you sure?" alert. Geeks, making the world a better place |
Here is the funny part; when you go to unblock someone, they have a "Are you sure?" alert.
another good laugh
ManOfTeal.COM a Proud UNA site, six years running strong! |
I cannot find this code in list_pop.php....
OK, here we go: the action for "block member" is:
onclick="$.post('list_pop.php?action=block', { ID: '510' }, function(sData){ $('#ajaxy_popup_result_div_510').html(sData) } );return false;">
so what I need to do is to add to the onclick statement: return confirm('Are you sure you want to block this member?') which will return either true or false based on clicking yes or no. Can anyone help with the code here?
There are none so blind as those that will not see. |
Do I need Actions Manager to make this edit?
I forgot I had the Actions Manager Premium by ESASE; I can edit the actions using that module! I think actions are actually stored in the database, correct?
There are none so blind as those that will not see. |
They are strored in "sys_objects_actions" table as {cpt_block} and {cpt_unblock}
Change their "Eval" value as below
1) for {cpt_block}
if ( {ID} == {member_id} || isBlocked({member_id}, {ID}) ) return; return "if(confirm('Are you sure you want to block this member?')){ $.post('list_pop.php?action=block', { ID: '{ID}' }, function(sData){ $('#ajaxy_popup_result_div_{ID}').html(sData); location.reload(); } ); } return false";
2) for {cpt_unblock}
if ({ID} == {member_id} || !isBlocked({member_id}, {ID}) ) return; return "if(confirm('Are you sure you want to Unblock this member?')){ $.post('list_pop.php?action=unblock', { ID: '{ID}' }, function(sData){ $('#ajaxy_popup_result_div_{ID}').html(sData); location.reload();} ); } return false";
Clear you cache and you're done
Do I need Actions Manager to make this edit?
I forgot I had the Actions Manager Premium by ESASE; I can edit the actions using that module! I think actions are actually stored in the database, correct?
Looking for Help? http://www.boonex.com/kevinmitnick |
Actually, if you go to your block list and select a member and then click on the unblock, it has an alert, "Are you sure" already built in. Geeks, making the world a better place |
You are correct. But my modification allow you to Block/Unblock a member from their profile page
Actually, if you go to your block list and select a member and then click on the unblock, it has an alert, "Are you sure" already built in.
Looking for Help? http://www.boonex.com/kevinmitnick |
Thanks Kevin,
That worked, excellent. Thanks Geek_girl for kickstarting this thread!
Stuart
They are strored in "sys_objects_actions" table as {cpt_block} and {cpt_unblock}
Change their "Eval" value as below
1) for {cpt_block}
if ( {ID} == {member_id} || isBlocked({member_id}, {ID}) ) return; return "if(confirm('Are you sure you want to block this member?')){ $.post('list_pop.php?action=block', { ID: '{ID}' }, function(sData){ $('#ajaxy_popup_result_div_{ID}').html(sData); location.reload(); } ); } return false";
2) for {cpt_unblock}
if ({ID} == {member_id} || !isBlocked({member_id}, {ID}) ) return; return "if(confirm('Are you sure you want to Unblock this member?')){ $.post('list_pop.php?action=unblock', { ID: '{ID}' }, function(sData){ $('#ajaxy_popup_result_div_{ID}').html(sData); location.reload();} ); } return false";
Clear you cache and you're done
Do I need Actions Manager to make this edit?
I forgot I had the Actions Manager Premium by ESASE; I can edit the actions using that module! I think actions are actually stored in the database, correct?
There are none so blind as those that will not see. |