Skip to Content Skip to Menu

Moderators assigned to specific users

  • sirweb
  • sirweb
  • OFFLINE
  • Posts: 226
  • Thanks: 25
  • Karma: 2
6 years 9 months ago #301340 by sirweb
Replied by sirweb on topic Moderators assigned to specific users

krileon wrote: I'd just use a redirect action and send them back to that users profile with a message if they're not authorized to edit them via your condition.


Can I use substitutions to create a conditíon like
'Logged in users´s' [cb_field] Not Equal To 'Profile owner´s [cb_field]
in order to check if they have the same value on [cb_field] ?
How do I pick up the value of [cb_field] for the currently logged in user?

Thanks.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
6 years 9 months ago #301352 by krileon
Replied by krileon on topic Moderators assigned to specific users

Can I use substitutions to create a conditíon like
'Logged in users´s' [cb_field] Not Equal To 'Profile owner´s [cb_field]
in order to check if they have the same value on [cb_field] ?
How do I pick up the value of [cb_field] for the currently logged in user?

Yes, use the user parameter in substitutions to do this. See the below substitution tutorial for usage information.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb

Example as follows.

[cb:userdata field="FIELD_NAME" user="#me" /]


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • sirweb
  • sirweb
  • OFFLINE
  • Posts: 226
  • Thanks: 25
  • Karma: 2
6 years 8 months ago #302360 by sirweb
Replied by sirweb on topic Moderators assigned to specific users
I have not finished this task, still have some issues.

I have created a Group structure as of Kyle´s suggestion.
I also created an Access level as suggested.

Partially, this works. The group moderators can only edit the users in their own group.
But instead of firing the Auto Action as described below, something else triggers and halts the edit attempt, with this message on a blank page:

"You cannot edit a `GROUP`. Only higher-level users have this power."

where GROUP is the group the user is assigned to. Stopping on a blank page is not the bet solution.
I dont know if it is CB that displays this message, it is not present in the language of my language file, so it is not translated.

I have installed Auto Action, always use the latest nightly build.

This Auto Action is ordered first in the action list.

Type: Redirect
Triggers: onBeforeUserUpdate, onBeforeUserProfileEditRequest.

Condition: [cb:userdata field="cb_loge" user="#me" /] NotEqualTo [cb_loge]
(checks if logged in user is authorised to edit, else go back with a meddage)

Action URL: return (go back to previous page)
Action message: You are not authorised to edit this user.


My intention with this Auto Action is to leave the moderator on the same page instead of viewing a blank page, and give a meaningful message.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
6 years 8 months ago #302390 by krileon
Replied by krileon on topic Moderators assigned to specific users
That's CBs access check. To redirect before that gets displayed you have to use onBeforeUserProfileEditRequest trigger then perform your redirect. Return redirect likely won't work here. If you want to send them back to the users profile they're attempting to edit use the following redirect URL.

index.php?option=com_comprofiler&view=userprofile&user=[user_id]


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: sirweb

Please Log in or Create an account to join the conversation.

  • sirweb
  • sirweb
  • OFFLINE
  • Posts: 226
  • Thanks: 25
  • Karma: 2
6 years 8 months ago #302413 by sirweb
Replied by sirweb on topic Moderators assigned to specific users

krileon wrote: That's CBs access check. To redirect before that gets displayed you have to use onBeforeUserProfileEditRequest trigger then perform your redirect. Return redirect likely won't work here. If you want to send them back to the users profile they're attempting to edit use the following redirect URL.

index.php?option=com_comprofiler&view=userprofile&user=[user_id]


Ok thanks for the suggestion,
I already had the onBeforeUserProfileEditRequest trigger, so I deleted the other trigger in case it conflicted.
Unfortunately, that did not make any difference, onBeforeUserProfileEditRequest does not fire.
It looks like CBs access check still has priority.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
6 years 8 months ago #302424 by krileon
Replied by krileon on topic Moderators assigned to specific users
That trigger works perfectly fine. Your issue is likely with your Conditions or Access. Try removing your conditions and see if the redirect takes place.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: sirweb

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum