vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=323988

Any API call for updating a social group icon?
by incursio
07 Dec 2016 15:24

I've been digging for a bit, but haven't found anything concrete yet.

Basically, I just need a way to set/update a social group icon image from a separate script. Any ideas? Thanks in advance for any guidance!

Cheers.

noypiscripter 07 Dec 2016 17:50

Call the /uploader/uploadSGIcon frontend controller. To see what parameters are passed, try inspecting the AJAX call when you go to the group channel page and then clicking Edit Group Icon that appears when you hover the group icon, and then upload an image.

You can see the code for uploadSGIcon in actionUploadSGIcon() function in /includes/vb5/frontend/controller/uploader.php.

incursio 07 Dec 2016 18:44

Yeah, I was looking at that. Not sure what you mean by "call the controller", though. That file isn't part of the API, right?

EDIT: Oh, you mean call it by CURL or what not ... yeah that would work :p

--------------- Added 07 Dec 2016 at 19:09 ---------------

Actually, after tinkering a bit, that won't work, at least not as easily, because you run into vBulletin authentication issues with the cURL request :(

Replicant 07 Dec 2016 21:51

You have to be logged in with the stay logged in check box clicked so that the cookies are set. Then when you call the function with curl, make sure the cookie info is included on the command line. If you are logged in and the cookie info is included, there are no authentication issues. I do it all the time.

incursio 07 Dec 2016 23:36

I was building this as a command line tool as it might need to run via cron, but I suppose I can make it browser based instead.

Cheers.

noypiscripter 08 Dec 2016 01:38

If you look into the actionUploadSGIcon() method in the controller, you would see that it is calling the upload method in the content_attach API to upload the image and then calling the update method in the content_channel API to update the social group channel with the uploaded image.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

You can basically do the same.

incursio 08 Dec 2016 01:40

Yeah, that's what I ended up doing! :p

Cheers.


All times are GMT. The time now is 20:35.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.