SOLDED: Set GJ "Group Logo Default" to creator's avatar at new group creation.

1 month 4 weeks ago - 1 month 4 weeks ago #337404 by NFA
I think that is a cut, summarize and paste error under time pressure, knowing that you always come online around this time ;-).

This CB Auto Action really worked well for over a thousand times, until last build. I cannot paste full code in this ticket as ticket software doesn't like the HTML and many CB substitutions inside it.

Basically it is summarized something like:
$group = $variables['var1'];
$group->params()->set( 'about_content', "xxxxxxdfsdfdsadfsda");
$group->set( 'params', $group->params()->asJson() );
$group->store();

Can you tell me what kind of errors and broken PHP you see in this code?

Please Log in to join the conversation.

1 month 4 weeks ago - 1 month 4 weeks ago #337408 by krileon
What trigger are you doing this on? My best guess is you're breaking out of the quotes when setting about_content in your HTML and that's likely causing the fatal error. If you're surrounding the value with double quotes be sure your HTML is double quote escaped. For example the following shouldn't error.
$group = $variables['var1'];
$group->params()->set( 'about_content', 'TEST' );
$group->set( 'params', $group->params()->asJson() );
$group->store();

The logo changes themselves would not cause any problems here as gain it's just a URL switch in the image output.


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.

1 month 4 weeks ago - 1 month 4 weeks ago #337409 by NFA
trigger: gj_onAfterCreateGroup

But about the logo. I forgot to notice, but the new function is not working. After new group creation without logo, the logo is still as before the build the default set in GJ (Group Logo Default).

Please see attached file for the code. A lot off quotes indeed, but I think all right 

Attachment (removed by editor)
Attachments:

Please Log in to join the conversation.

1 month 4 weeks ago #337411 by krileon
Looks like it's only working while logged in due to an access check issue. Am fixing for a new build.

As for your code that's a ton of HTML to be packaging into that. My guess is you've an escaping error. Try my above example code with no HTML at all and see if it still errors.


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.

1 month 4 weeks ago #337412 by krileon
Oops, my access check issue is due to my avatars being protected by CB Privacy. Make sure you haven't done the same, lol. Below is it working fine.

Logged In
 

Logged Out
 


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.
Attachments:

Please Log in to join the conversation.

1 month 4 weeks ago - 1 month 4 weeks ago #337414 by NFA
Cutting and pasting your exact code in a CB Auto Action brings the server error 500 back. So it looks like it isn't caused by my AutoAction/HTML/quotes code. I really think there is something changed on that part in your last CB build.

I don't believe I have ever used any CB privacy (setting) but I will investigate that.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.414 seconds

Facebook Twitter LinkedIn