[SOLVED] hide or publish entire user profile?

9 years 2 months ago #142297 by Joe028
I have a parameter in my user profiles which allows the user to either publish or unpublish their profile for public access. I have a filter set up in my userlist so that if someone check's 'unpublish' from their user profile, then they will not be shown in the userlist.

I am now realizing that if someone were to manually type in the url of that user's profile, even if they wished to be "unpublished", their profile is available. Is there a way to change this so that the user profile is completely offline so other user's can't see them, and then they could toggle it back on with a parameter in the user profile?

A related question. I was concerned about someone typing in a url manually and my url looks something like this "/user-profile/userprofile/i]username[/i.html". I can't remember if I created this with a SEF setting or not. How are the urls generated by default? is there a way I could turn profile urls back to dynamic urls?

Thanks.

Post edited by: krileon, at: 2010/09/20 15:27
9 years 2 months ago #142332 by krileon
No, you'd need to make a new CB plugin that checks this field and redirects if it is not set appropriately. That should meet your needs, but out of the box no it's not possible. Please see tutorials within my signature for trigger usage in a new CB plugin.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
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 EST to 4:00 PM EST. 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.
9 years 1 month ago #142418 by Joe028
Okay thanks for the answer. It is not a top priority for me right now, but it will be soon. When I do I will try to remember to post what I did here so if anyone else is interested they could just copy what I did. Thank you very much.
9 years 1 month ago #143113 by Joe028
I've found a solution that worked in my application if anyone is interested. I used the "hello world" part 2 that is provided as an example through Joomlapolis.

I really didn't change much at all, just removed the code that displays the tab (I had no need for any type of display for the user). Then I added this:

[code:1]if($my->id != $user->id) {
if (( $user->cb_publishprofile == "No" ) || ( $user->cb_eventpublish == "No" )){
header('Location: www.bartendmyparty.com/unpublished-redirect.html ');
}
}[/code:1]

I had two different parameters to check, and I also didn't want the user to be redirected away from their own profile if they chose to have it unpublished.

I'm following up here because I'm a complete novice with programming and wondered if anyone saw any problems with what I had done.

I have 2 primary concerns. I did not need to use a trigger, which I thought I would have had to do (do I?) And the first line is:

[code:1]defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );[/code:1]

I've seen where this line has more to it. Am I leaving myself vulnerable by having this line of code here and not something more?

Thanks.
8 years 10 months ago #150132 by redkeane
Thanks very much for this solution.

I slightly modified the redirect url to point to an "Access Denied" article and provided a "return to previous page" link.

Couldn't have done it with out this solution.

Thanks again.

Post edited by: redkeane, at: 2011/01/05 13:38

Post edited by: redkeane, at: 2011/01/05 13:39
Attachments:
Moderators: beatnantkrileon
Time to create page: 0.413 seconds
Facebook Twitter Google LinkedIn