![]() |
The error isn't in misc.php it's in one of your plugin's, misc.php is called when one of yourplugins doesn't give a result.
|
I know it's not in misc.php and the only plugin is the mod I'm working on. What I don't understand about the error is ... what exactly is it looking for?
I mean there are no ` in the mod, so is it looking for ]' or ']' or ']'' or ] ? --------------- Added [DATE]1346177661[/DATE] at [TIME]1346177661[/TIME] --------------- Found the elusive missing ] :D |
Good man :), i know what it's like, you look so hard for so long you get code blind and can't see the nose in front of you!
|
Well it's my own fault. I had two copies of the xml, one was the master copy and the other was used to work on. I accidentally deleted the master copy instead of the borked working copy :D
So now I'm still using the borked working copy (for some reason it keeps giving me the error that I'm already unsubscribed even though I'm not), but once I get it unborked it will become the new master. |
I'm still stuck on the existing subscribe threads. I'm unable to get a working loop done. Just wanted to update those that are following this, it's not forgotten it's just stalled :D
|
I need a fresh set of eyes to help me find out why this code is returning a parse error (or tell me how screwed up the code itself is as I'm just not getting this stupid loop thing :( ) Since the rest of the queries start with $unsubscribe does this one have to use it as well? I was understanding that the loop variable should be different but as I said before I'm obviously not getting it :D
Another related question, in order to get around the email error being returned with this query, would I use another JOIN statement to add the email to the insert query? If so which one? Code:
if ($vbulletin->options['advanced_unsubscribe_link_thread_sub_backup']) |
Quote:
Code:
if ($vbulletin->options['advanced_unsubscribe_link_thread_sub_backup']) |
Oh my .... how silly of me :D Thanks nerbet :)
|
Ok so I'm still having trouble with the stupid looping through the subscribethread table and decided that I needed to exclude the mods, supermods, and admins from having their subscriptions or usergroups (that code isn't shown here) changed.
However I'm a bit confused on how to do this. I need to LEFT JOIN the usergroupid from the user table, but the following code spits out a syntax error and I'm not seeing it. Code:
// If you selected to backup existing thread subscriptions this code will be executed. |
Other than spacings around TABLE_PREFIX it seems fine (altough i haven't checked the tables...etc it calls)
PHP Code:
This should help with your syntax (remember to only use the query part rather than the whole php :)) http://developer.mimer.com/validator...dex.tml#parser |
Are you getting an sql syntax error or a php syntax error?
You're trying to select the rows from subscribethread for only one user so you really only need to check the usergroupid and either do the query or not. If you don't have the usergroupid for that user available then you do save one query by combining it like that, but since this is for something that is executed rarely compared to everything going on on the forum, it might be a better idea to do two separate queries and have the code be less complicated. Having said all that, the way you have it is doing a join to the UPDATE query, but the WHERE goes with the select, so it will probably tell you that there's no column named 'usergroupid'. Maybe you should do this instead: Code:
INSERT INTO " .TABLE_PREFIX. "unsub_subscribethread AS unsub_subscribethread |
Hmmm so it would be better to run the check before executing any of the queries (I was planning on excluding those user groups from each query) instead of building the conditional into the query? I suppose I should go a step further and create a setting to allow admins to exclude certain user groups, what do you guys think?
My thinking was that since the subscribethread table doesn't have the usergroupid column, that I needed to call if from the user table. But I don't see why you went with user.userid = unsub_subscribethread.userid? I'm pretty much stalling on this due to the fact that I just can't seem to wrap my head around the proper loop. I've done some reading and I've searched for examples, but nothing I have found seems to have "clicked" with my brain yet :D |
Quote:
Quote:
Quote:
|
Don't worry about dumping this on me, I'll eventually either figure out the loop or ask you to figure it out for me :D
Your reason for editing the post has me intrigued ;) Now back to the JOIN statement just for clarification since I'm almost done setting up the exclude user groups settings :) user.userid = unsub_subscribethread.userid ... I thought that this would only pull the userid from the user table, hence my confusion. The entire point of joining the user table was to grab the usergroupid for use in checking user groups in the query. I am assuming that is how JOIN works (grabbing only the column listed in the ()'s ) but I also assumed that I would be done with this mod by now :D |
Quote:
Quote:
|
AH I see what happened here, you were referring to the code I pasted (#86) showing a failed attempt at looping :D
I should've mentioned that I scrapped that bit of code and my question regarding the LEFT JOIN was for the code in post #89 :) But it's a moot point now, I get the gist of what you were saying in regards to the LEFT JOIN :) |
I'm getting a parse error when I have this code un-commented, I suspect it's the LEFT JOIN but then again what do I know :D
I'm trying to join the user table to pull the email column so the mod doesn't return the email error if there is no email column in the table. Code:
// If you selected to change existing thread subscriptions this code will be executed |
Your ON clause is wrong, one of the fields needs to be from the subscribethread table.
|
Thanks for replying squid :) I changed the ON clause and still have a parse error :(
Code:
// If you selected to change existing thread subscriptions this code will be executed Code:
(user.email = subscribethread.userid) |
Quote:
Code:
ON user.userid = subscribethread.userid |
Dangit ... I knew I didn't fully understand the JOINs ...
The subscribethread table doesn't have an email column, but if I JOIN the user table I don't have to mention the email table (in the JOIN) in order to use it in the UPDATE ... WHERE as long as the userid from the user table matches the userid from subscribethread table? |
Quote:
If what I understand you want to achieve why not use the following query: PHP Code:
|
Ok so JOINs can't be used in an UPDATE? I don't recall reading that anywhere :(
The reason I'm trying to include the email field is that if I don't it trips an error further along the mod about not inputting a valid email and doesn't complete the query. Code:
// If an email isn't entered or is invalid show this error I do use ( for the $db->queries and they do have the ; at the end :) |
Ok so I sorta started working on this again, and I can't figure out what's wrong here. I'm trying to copy the rows from subscribethread to unsub_subscribethread *yes it does exist*. Yes the option is selected in the ACP. The mod runs but doesn't spit out ANY errors, it also doesn't copy the rows :(
This is the select query I'm using Code:
$unsubscribe = $db->query_read("SELECT NULL, userid, threadid, emailupdate, folderid, canview FROM " .TABLE_PREFIX. "subscribethread WHERE userid = '$id' AND emailupdate IN (1, 2,3)"); Code:
// If you selected to backup existing thread subscriptions this code will be exectued. Code:
INSERT INTO unsub_subscribethread |
Are you sure $id has the right value?
|
Quote:
you havent registered the variable $unsubscribe here is an example of how to do so $templater = vB_Template::create('unsubscribe'); $templater->register('$unsubscribe', $unsubscribe); $template_hook[forumhome_wgo_pos2] .= $templater->render(); you will then need to call $unsubscribe in a template which will display the content from the query remembering to change the $template_hook you will then need to place {vb:raw unsubscribe} in template unsubscribe as long as you place the correct hook location with the correct template hook the query will show in the hook location you selected |
1 Attachment(s)
Oh great now I'm even more confused ... this mod uses misc.php?do=unsubscribe as the url. In the mod a basic template is "built" and all of the other code executes fine (so far). I have a few more select queries structured like the one I posted earlier ... they seem to work just fine.
So now I'm wondering ... is the mod even executing those select queries? If it's working as is now (aside from the code in question) do I still need to tie it into a hook? Keep in mind I'm a complete novice at this, all I'm doing is added options to an existing mod (that was marked as reusable and updated for 4.x by kh99). Just for shits n giggles I'm going to attach what I have so far, if someone would be kind enough to look at it and tell me if there's a better way to go about doing this I might as well find out now and switch gears :D |
All times are GMT. The time now is 06:24 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|