[SOLVED] Adding fav...
 
Notifications
Clear all

[SOLVED] Adding favorite authors automatically adds admin

3 Posts
1 Users
0 Reactions
1,123 Views
(@misskitten)
Posts: 26
Eminent Member
Topic starter
 

URL to your eFiction: http://fannation.shades-of-moonlight.com/archive/authors.php?list=authors
Version of eFiction: 3.4.3
Have you bridged eFiction, if so with what?: No
Version of PHP: support for both 4/5
Version of MySQL: 5-something it seems
Have you searched for your problem: yes
If so, what terms did you try: "favorite authors" "favorite authors admin"
State the nature of your problem:

First the problem was that you got an error whenever adding an author from the profile, but I searched the site and found a solution to that problem, but the second problem is that while adding a favorite author now works, the site only adds the author with the userId 1 to favorites, no matter what author you try to add. Here that user is "admin". It's the same whether you try to add an author from the dropdown menu of a story or use the add-link on the author's profile.

There is also the matter of another error where we get the following message whenever viewing the favorite authors of a user:

Notice: Undefined index: add in /home/.camry/fannation/fannation.shades-of-moonlight.com/archive/user/favau.php on line 37

Do you have a test account for us?
Not anymore.


FanNation - where stories never have to end...

 
Posted : 24/08/2008 10:05 am
(@misskitten)
Posts: 26
Eminent Member
Topic starter
 

Okay, I have solved the situation of always adding the admin as favorite author, when I searched for the problem that didn't add favorite authors from the profile, I found the following suggestion:

to find the following in "user/profile.php":

<a href=""user.php?uid=".USERUID."&amp;action=favau&amp;author=".$userinfo['uid'"]."">"._ADDAUTHOR2FAVES."</a>

and change it to:

<a href="""._BASEDIR."user.php?action=favau&amp;add=1&amp;author=".$stories['uid'"].($stories['coauthors'] ? ",".$stories['coauthors'] : "")."">"._ADDAUTHOR2FAVES."</a>

this solved the problem of not being able to add a favorite author, but the new problem was that it now always added the admin as favorite author, what I did was change it to this:

<a href="""._BASEDIR."user.php?action=favau&amp;add=".$userinfo['uid'"]."&amp;author=".$stories['uid'].($stories['coauthors'] ? ",".$stories['coauthors'] : "")."">"._ADDAUTHOR2FAVES."</a>

And the problem of adding a favorite author from the profile was solved.

However, this did not solve the problem of adding an author as a favorite on a specific story, for that I had to locate the following code in "viewstory.php":

<option value="user.php?action=favau&amp;add=1&amp;author=".$stories['uid'].(count($storyinfo['coauthors']) ? ",".implode(",", array_keys($storyinfo['coauthors'])) : "")."">"._ADDAUTHOR2FAVES."</option>

and change it to:

<option value="user.php?action=favst&amp;add=1&amp;sid=$sid">"._ADDSTORY2FAVES."</option><option value="user.php?action=favau&amp;add=".$stories['uid']."&amp;author=".$stories['uid'].(count($storyinfo['coauthors']) ? ",".implode(",", array_keys($storyinfo['coauthors'])) : "")."">"._ADDAUTHOR2FAVES."</option>

I haven't yet solved my last issue of an error displaying whenever viewing someone's favorite authors, but that one was less critical.


FanNation - where stories never have to end...

 
Posted : 24/08/2008 5:33 pm
(@misskitten)
Posts: 26
Eminent Member
Topic starter
 

I think I found a quick solution to the last problem I presented:

The reason this message was displayed:
Notice: Undefined index: add in /home/.camry/fannation/fannation.shades-of-moonlight.com/archive/user/favau.php on line 37

Is because the script tries to access $_GET['add'] regardless if it exists or not and then tries making it into an array. If you open "user/favau.php" and replace the following code:

$author = explode(",", $_GET['add']);

with:

$author = ($add) ? explode(",", $_GET['add']) : array();

The problem cease to exist.


FanNation - where stories never have to end...

 
Posted : 24/08/2008 5:41 pm
Share: