MSM update in 2.1.6 breaks Favorite:save tag :: UPDATE: “Bug” found in Favorites Module for MSM sites
Posted: 31 March 2008 11:25 AM   [ Ignore ]
Newbie
Avatar
Rank
Total Posts:  28
Joined  2006-05-18

Here’s an example of how we’re using Favorites and EE’s MSM (Multiple Site Manager). Before we upgraded to Favorites 2.1.6, everything worked perfectly.

The sites are:

public.site.com = the site everyone sees regardless of if they are a member of the site or not.
members.site.com = a sub-domain site that allows members to keep a list of their favorite entries, Rate them, etc.....

When you become a member of the site, you now see links to “Add to your Favorites” on some entries. Prior to the upgrade to 2.1.6, the following link on the public.site.com would work: members.site.com/add/ID#

Now it doesn’t. It returns an error stating that that Entry ID doesn’t exist. If instead I create an “add” template on the public site and link the “Add to faves” to it, it works. For example: public.site.com/add/ID#

We’re eventually going to add AJAX to the “Add to faves” link so the user isn’t taken away from the entry. But for this first iteration, the contract calls for the link to take them to their Favorite listing in the members.site.com site.

Everything with Favorites worked perfectly, as far as I could tell, with MSM when we were running 2.1.2. Since Entry IDs are unique across even MSM sites, it doesn’t make sense to me that the way the favorites:save function used to work would be changed so it now doesn’t work across MSM sites???

 Signature 

--
Partner, Bare Feet Studios LLC
http://www.barefeetstudios.com
http://www.beachwalks.tv
http://reef.beachwalks.tv

Follow me on Twitter: http://twitter.com/shane

Profile
 
 
Posted: 31 March 2008 11:28 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2261
Joined  2006-10-18

Shane,

Have you tried it with adding the site="site1|site2" parameter to the Favorite:Save tag? smile

 Signature 
Profile
 
 
Posted: 31 March 2008 11:57 AM   [ Ignore ]   [ # 2 ]
Newbie
Avatar
Rank
Total Posts:  28
Joined  2006-05-18

NO! That would make too much sense!!  smile (Plus, first thing I did was check the docs to see if there were changes to the tag syntax and didn’t find anything so I decided it would be easier to complain about it. wink )

OK, so that does work to save IDs across MSM sites. I can now see them listed in the Module Control Panel. But now they don’t show up in my list on my members page. Here’s the code that used to work:

{exp:favorites:entries site="member_site"  weblog="blog" status="open|testing" dynamic="off"}
{title}
{
/exp:favorites:entries}

where the URL to get to this template is members.site.com / view / current_username / current_user_id / (spaces for reading clarity)

Once again I headed back to the docs to see why, even when specifying the site="” (which I have always done with Favorites) now doesn’t work.

Hmmmmmmm?

 Signature 

--
Partner, Bare Feet Studios LLC
http://www.barefeetstudios.com
http://www.beachwalks.tv
http://reef.beachwalks.tv

Follow me on Twitter: http://twitter.com/shane

Profile
 
 
Posted: 31 March 2008 12:01 PM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2261
Joined  2006-10-18

Strange.... I can get it to work on my site…

Is perhaps the weblog="” parameter setting it off? Does that weblog apply to that site? smile

I’ve added the “site” parameter to the docs for Favorites:Save wink

 Signature 
Profile
 
 
Posted: 31 March 2008 12:13 PM   [ Ignore ]   [ # 4 ]
Newbie
Avatar
Rank
Total Posts:  28
Joined  2006-05-18

My bad. In changing out the param values to protect the innocent, I used a bad example. Good catch tho!  Had that been the case it would have been a stooooopid mistake on my part.  smile

Here’s a better example:

<ul>
{exp:favorites:entries site="public_site" weblog="blog" status="open|testing" dynamic="off"}
<li> <title></li>
{exp:favorites:entries}
</ul>

 Signature 

--
Partner, Bare Feet Studios LLC
http://www.barefeetstudios.com
http://www.beachwalks.tv
http://reef.beachwalks.tv

Follow me on Twitter: http://twitter.com/shane

Profile
 
 
Posted: 31 March 2008 12:34 PM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2261
Joined  2006-10-18

I hope this was another accidental mistake: LOL

Your example is missing the forward slash on the exp:favorites:entries loop… just want to make sure that’s not the problem either.

<ul>
{exp:favorites:entries site="xostamsm" weblog="xosta1" status="open|closed" dynamic="off"}
<li><a href="{permalink='favorites'}">{title}</a></li>
{/exp:favorites:entries}
</ul>

I’ve otherwise tried testing this with exact same code you have and it works for me… if this isn’t the issue, may I see the rest of the code in your template?
By “Members” page, are you using the User Module or native EE Members templates?

 Signature 
Profile
 
 
Posted: 31 March 2008 12:36 PM   [ Ignore ]   [ # 6 ]
Newbie
Avatar
Rank
Total Posts:  28
Joined  2006-05-18

In order to test this as purely as possible, I’ve created a test template in both the “member_site” and “public_site” MSM sites.

Here is the actual, real, and only code that is in both of these templates.

<hr />
<
ul>
 
{exp:favorites:entries site="herecomestheguide" weblog="location" status="open|testing"}
<li>{title}</li>
 
{/exp:favorites:entries}
</ul>
<
hr />

The site name is correct.
The weblog name is correct
I have 4 “locations’ in the Favorites Control Panel assigned to me. I just added them.
All 4 locations have a status of Open.
I am logged in.
Neither template shows anything except the HR and UL tags (if you view the source)
This all worked prior to the upgrade today from 2.1.2 to 2.1.6

I’m going to de-install the Module and start over.........

 Signature 

--
Partner, Bare Feet Studios LLC
http://www.barefeetstudios.com
http://www.beachwalks.tv
http://reef.beachwalks.tv

Follow me on Twitter: http://twitter.com/shane

Profile
 
 
Posted: 31 March 2008 12:51 PM   [ Ignore ]   [ # 7 ]
Newbie
Avatar
Rank
Total Posts:  28
Joined  2006-05-18

Still no worky. Going insane here....

In answers to your questions:

1. Yes, my example was a typo in forgetting the / in the exp:favorites:entries closing tag.

2. I’m not using any EE or User Module member anything. I’m just using a regular template. The docs say if a user_id is not present in the URL then the Favorites of the currently logged in user will be used. That’s always worked. Also, for customization purposes, the URL segments contain both the CURRENT_USER and the USER_ID as such:
members.site.com / view / shane / 123 (spaces for readability)

I also tried to use the “username="CURRENT_USER” in the favorites:entries tag but it doesn’t make a difference.

It would be one problem to not be able to get Favorites into the system. But I can “save” them just fine and they appear in the Favorites Control Panel just as they should. Just can’t get anything to display with even the most basic code as provided above???

 Signature 

--
Partner, Bare Feet Studios LLC
http://www.barefeetstudios.com
http://www.beachwalks.tv
http://reef.beachwalks.tv

Follow me on Twitter: http://twitter.com/shane

Profile
 
 
Posted: 31 March 2008 01:34 PM   [ Ignore ]   [ # 8 ]
Newbie
Avatar
Rank
Total Posts:  28
Joined  2006-05-18

I definitely found the BUG!!

I have 3 sites in MSM:
public = site_id = 1
members = site_id = 3

1. A member is surfing the public site (http://public.site.com) and finds a nice article and adds it to their Favs. On the public site, they click “Add to favorites” which is a link to http://members.site.com/add/shane/123 (where “shane” and “123” are my username and my user_id)

2. On the /add template in the Members site, the code is {exp:favorites:save site="public"} (remember from above that “public” has a site_id of 1)

3. When I view the exp_favorites table directly, the entry I just added has a site_id = 3 ?!?  Why wouldn’t it have a site_id of 1? That’s what I specified for the “save” method of the Favorites Class.

4. I manually changed all the site_ids in the data table from 3 to 1 and everything works.

Seems the problem is that the INSERT is ignoring the site="” parameter for the save method of the Favorites Class. It’s just dumping in whichever site_id is the site you’re currently on.

 Signature 

--
Partner, Bare Feet Studios LLC
http://www.barefeetstudios.com
http://www.beachwalks.tv
http://reef.beachwalks.tv

Follow me on Twitter: http://twitter.com/shane

Profile
 
 
Posted: 31 March 2008 01:39 PM   [ Ignore ]   [ # 9 ]
Newbie
Avatar
Rank
Total Posts:  28
Joined  2006-05-18

Line 428 in mod.favorites.php reads

'site_id'  => $PREFS->ini('site_id'),

Can we get a conditional there so that if the “site=""" parameter is NOT set it will use the $PREFS->ini but that will get overridden if we specify the site="” parameter?

I’m fine with it being a site_id. I don’t care if it’s the “people friendly” name or not.  smile

 Signature 

--
Partner, Bare Feet Studios LLC
http://www.barefeetstudios.com
http://www.beachwalks.tv
http://reef.beachwalks.tv

Follow me on Twitter: http://twitter.com/shane

Profile
 
 
Posted: 01 April 2008 07:53 AM   [ Ignore ]   [ # 10 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2261
Joined  2006-10-18
Shane Robinson - 31 March 2008 01:34 PM

I definitely found the BUG!!


I have 3 sites in MSM:
public = site_id = 1
members = site_id = 3


1. A member is surfing the public site (http://public.site.com) and finds a nice article and adds it to their Favs. On the public site, they click “Add to favorites” which is a link to http://members.site.com/add/shane/123 (where “shane” and “123” are my username and my user_id)

2. On the /add template in the Members site, the code is {exp:favorites:save site="public"} (remember from above that “public” has a site_id of 1)

3. When I view the exp_favorites table directly, the entry I just added has a site_id = 3 ?!?  Why wouldn’t it have a site_id of 1? That’s what I specified for the “save” method of the Favorites Class.

4. I manually changed all the site_ids in the data table from 3 to 1 and everything works.

Seems the problem is that the INSERT is ignoring the site="” parameter for the save method of the Favorites Class. It’s just dumping in whichever site_id is the site you’re currently on.

Shane,

I checked into my test site, and all my data seems to be stored correctly.... is there any chance that those were entries stored before you applied the site="” parameter to the Favs:Save variable?

With everything in order now, give it another whirl and see what happens smile

 Signature 
Profile
 
 
Posted: 01 April 2008 07:55 AM   [ Ignore ]   [ # 11 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  2261
Joined  2006-10-18
Shane Robinson - 31 March 2008 01:39 PM

Line 428 in mod.favorites.php reads

'site_id'  => $PREFS->ini('site_id'),


Can we get a conditional there so that if the “site=""" parameter is NOT set it will use the $PREFS->ini but that will get overridden if we specify the site="” parameter?

I’m fine with it being a site_id. I don’t care if it’s the “people friendly” name or not.  smile

I will submit this as a feature request smile

 Signature 
Profile
 
 
Posted: 02 April 2008 01:04 PM   [ Ignore ]   [ # 12 ]
Newbie
Avatar
Rank
Total Posts:  28
Joined  2006-05-18

Exxxxxxcellent.  smile

Otherwise, I’m not sure what use the “site=” parameter in the exp:favorite:entries exp:favorites:save tag is for?

I’ve hacked mine for now since all Favorites will come from site = 1.

 Signature 

--
Partner, Bare Feet Studios LLC
http://www.barefeetstudios.com
http://www.beachwalks.tv
http://reef.beachwalks.tv

Follow me on Twitter: http://twitter.com/shane

Profile