[SOLVED] Auto Actions Redirect- Profile Private?

12 years 3 months ago - 12 years 3 months ago #190399 by fader8
Hey folks!
I have a request from some users to allow them to toggle their profiles accessibility to other site members. Kind of a "Offline for Maintenance" toggle that would redirect other members if they went to your profile. Yes I've told them they can just make all their tabs invisible (cb privacy), but they moaned..... So I thought I'd take a shot at it! I haven't promised anything though. ;)

I created a dropdown select field called cb_profileprivacy available in profile edit, with 2 values:

Profile Online
Profile Offline

Here's my Auto Actions settings:

Type: Redirect

Triggers: OnBeforeUserProfileRequest

User: Auto

Access: Author (all my regular members are authors)

First Conditional: cb_profileprivacy - Equal To - Profile Offline
Second Conditional: user_id - Equal To - myid

Redirect Action....
URL: return
Message: User has taken their profile offline. Try again later.

Exclude: 62

I must have something wrong since it isn't working. Seems like I'm almost there, but a nudge in the right direction at this point would be really helpful!

Joomla 1.5.25, CB 1.8rc2, CBSubs 1.2.2, GroupJive 2.5rc, Kunena 1.7.2, php 5.2.5

Please Log in to join the conversation.

12 years 3 months ago #190456 by krileon
Replied by krileon on topic Re: Auto Actions Redirect- Profile Private?

First Conditional: cb_profileprivacy - Equal To - Profile Offline
Second Conditional: user_id - Equal To - myid

You need to use substitutions. Example as follows.

[cb_profileprivacy] - Equal To - Profile Offline
[cb:userdata user="#displayed" field="user_id" /] - Not Equal To - [cb:userdata user="#me" field="user_id" /]

What the above does is first compare then privacy field to ensure it's set to offline then compare the displayed user to the viewing user and if they're not a match then redirect away. You may need to use onBeforeUserProfileDisplay trigger instead though, but try the current one first.


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 to join the conversation.

12 years 3 months ago #190483 by fader8
Replied by fader8 on topic Re: Auto Actions Redirect- Profile Private?
Thanks Kyle!
Getting closer! It's working, almost...

OK, using Request or Display doesn't seem to matter.

It falls down if I return the user to a CB page, like back to their own profile, so I'm redirecting to the home page (with message) for now. I'll probably make a page just for that. So that part's OK.

The only issue now is that it also blocks the logged in user from their own profile if they have set their profile as offline! Looking at the strings you provided, that just shouldn't be the case. Hmmm... sticky one...

Just tried switching the order of the conditionals. No joy there.

Perhaps comparing user names rather than user ID's? You would think it wouldn't matter....

Joomla 1.5.25, CB 1.8rc2, CBSubs 1.2.2, GroupJive 2.5rc, Kunena 1.7.2, php 5.2.5

Please Log in to join the conversation.

12 years 3 months ago #190485 by krileon
Replied by krileon on topic Re: Auto Actions Redirect- Profile Private?
User IDs vs Usernames, it won't matter. It's possible the substitutions aren't outputting as expected. Please add both to a delimiter field and review what is outputting to ensure it's what is expected. 1 should be the ID of the users profile and the other the ID of the user viewing the profile.


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 to join the conversation.

12 years 3 months ago - 12 years 3 months ago #190575 by fader8
Replied by fader8 on topic Re: Auto Actions Redirect- Profile Private?
Hey Kyle,
OK, I tried this out in a cb content module. Using your strings and and also trying user names after studying your subs tutorial for a bit. Here's the exact content:
[cb:userdata user="#displayed" field="user_id" /]  [cb:userdata user="#me" /] 
<p>You are [cb:userdata field="username" /] and you are viewing [cb:userdata field="username" user="#displayed" /]'s profile.</p>

Resulting in:



So something's up with fetching the user ID? Is the user ID contained in a "field" in the cb sense? I got the same thing when I tried it in a delimiter field, btw.

So I tried those user name substitutions in the auto action.

If:

[cb_profileprivacy] - Equal To - Profile Offline

And:

[cb:userdata field="username" /] - Not Equal To - [cb:userdata field="username" user="#displayed" /]

Then:

Redirect

This works, but the same as things did when I tried your ID substitutions before. Blocks access to the profile for everyone including the profile's owner. (I'm keeping this! It's a way cool user punishment!) But besides that, it seems this needs one more bit of logic or something. Should work though. When viewing your own profile, those values are equal, so....

....scratching my head...

Joomla 1.5.25, CB 1.8rc2, CBSubs 1.2.2, GroupJive 2.5rc, Kunena 1.7.2, php 5.2.5
Attachments:

Please Log in to join the conversation.

12 years 3 months ago #190595 by krileon
Replied by krileon on topic Re: Auto Actions Redirect- Profile Private?
Tested and confirmed the below functions for obtaining the $user user_id and matching it against the viewing users user_id.

[user_id] Not Equal To [cb:userdata field="user_id" 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.
The following user(s) said Thank You: fader8, haasdijk

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.202 seconds

Facebook Twitter LinkedIn