Skip to Content Skip to Menu

Token change for moderators

  • activha
  • activha
  • OFFLINE
  • Posts: 2332
  • Thanks: 117
  • Karma: 13
1 month 3 weeks ago #339227 by activha
Token change for moderators was created by activha
Hi Kyle

I use this : $plaintext = (string) \CBLib\Application\Application::MyUser()->getUserId(); in order to set the user id, then issue and store a token.
After that I have a redirect to [cb:url location="profile_view" /]
The autoaction is for registered users only

I'd like to allow my moderators to issue or renew token on behalf of users. But of course the above code works only for them.

How can I retrieve the viewed user id and redirect to its profile if I'm a mod ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48512
  • Thanks: 8286
  • Karma: 1444
1 month 3 weeks ago #339228 by krileon
Replied by krileon on topic Token change for moderators
Getting the displayed user id is only possible if you're actually on the users profile. Typically what you'd do is just send the user id to the auto action via the URL. It has automatic support for that by setting &users=USER_ID and will use that for setting the auto action user. If you are actually viewing a users profile then the below should output the displayed profile user id.
Code:
global $_CB_framework; $user_id = $_CB_framework->getDisplayedUser();


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.

  • activha
  • activha
  • OFFLINE
  • Posts: 2332
  • Thanks: 117
  • Karma: 13
1 month 3 weeks ago #339229 by activha
Replied by activha on topic Token change for moderators
Great thanks !

Do you have also a substitution for url redirection to redirect to the viewed user profile ?

I tried [cb:url location="profile_view" user="[userid]" /] but it does not take the user parameter 

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48512
  • Thanks: 8286
  • Karma: 1444
1 month 3 weeks ago #339230 by krileon
Replied by krileon on topic Token change for moderators
That substitution should work fine, but you're substituting [userid] which doesn't exist. You need to use [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: activha

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

  • activha
  • activha
  • OFFLINE
  • Posts: 2332
  • Thanks: 117
  • Karma: 13
1 month 3 weeks ago #339231 by activha
Replied by activha on topic Token change for moderators
Oupssss sorry , thanks a lot for the help
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum