News Module: "more" links to admin page instead of detail page?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
ganeshXL

News Module: "more" links to admin page instead of detail page?

Post by ganeshXL »

I just installed CMS MS y'day and was pleased with how fast everything works.

There's just one thing that's bugging me (and yes, I did search the forum and the mantis bug DB as well):

When I have news items published, I see them fine on the overview page (Title + "more" link).
But these "more" links all point to
http://www.myserver.com/cmsmadesimple/[b]admin[/b]/moduleinterface.php?module=News&id=cntnt01&cntnt01action=detail&cntnt01articleid=1&cntnt01returnid=-1
which is obviously wrong.

Even when manually removing the "admin" dir from the URL, I get a 404 error msg though o_O

In other words, http://www.myserver.com/cmsmadesimple/m ... eturnid=-1
doesn't work either.

I don't see any config options anywhere, so I assume it's a bug. Did anyone else stumble upon this? It's weird, because the other stuff works fine.

If this can be fixed by changing a few lines of code, please tell me where + how. As I understand, the latest release only fixed a security hole, there wasn't any mention of this kinda stuff...

v. 0.1, PHP 4.3.x
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: News Module: "more" links to admin page instead of detail page?

Post by Ted »

This was an easy fix.  I did it a few weeks ago.

Basically, go to around line 1500 in modules/News/News.module.php and look for

Code: Select all

$newnews->DoAction('default', 'newsmodule', $params);
And change it to:

Code: Select all

$newnews->DoAction('default', 'newsmodule', $params, $variables['page_id']);
ganeshXL

Re: News Module: "more" links to admin page instead of detail page?

Post by ganeshXL »

Thanks for the reply.

I found the line, replaced it like you suggested, but that didn't change a thing.

I even deleted all existing news items, wrote new ones, but the same thing happened again.

Just exactly why is it linking to the ADMIN section in the public site? Doesn't make sense to me. Even when logged out of the admin section, I get that link.

Weird.
perl4ever

Re: News Module: "more" links to admin page instead of detail page?

Post by perl4ever »

I'm having the same problem.  Made the code changes.  Deleted browser cache.  Restarted Apache, so it would not have cached pages.

Still get the /admin/ slice in there.

In my debugging, this is what I am finding:

wishy added the extra parameter for page_id.  I do a dump to html just prior to this changed line (see post, above), and my html out shows:

- variables(page_id) is () -

In otherwords, when you go from the bulletmenu to a page defined as a "News" type (content type is News), the News module does not set $variables['page_id'] to anything at all... it is null/empty.  So, the CreateLink function which tests to see if the ReturnID is NULL or -1 fires off the logic that adds the /admin/ part.

So - it seems that we need something else to create the page_id.  This is interesting, since in the breadcrumbs logic, I am also seeing a problem with not seeing page_id under certain situations.  (Refer to another post regarding breadcrumbs).

Ok - what's the fix on this?  It's the end of my day so I can't continue exploring this right now.

But I do need this solved - it is a major piece of the site and must function in order to this to go live!

Cheerio...
Last edited by perl4ever on Tue Sep 06, 2005 7:34 am, edited 1 time in total.
perl4ever

SOLVED: News Module: "more" links to admin page instead of detail page?

Post by perl4ever »

SOLVED!

Ok, folks.  I just had a spark, just as I was about to close out for the day.

It dawned on me that we need to remember the scope of a variable.

$gCms->variables['page_id'] is what is needed.

So, the line that needs changing is just before 1500:

Code: Select all

$newnews->DoAction('default', 'newsmodule', $params);
Change it to:

Code: Select all

$newnews->DoAction('default', 'newsmodule', $params, $gCms->variables['page_id']);
This should work.  Seems to work for me, now.

G'nite.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: News Module: "more" links to admin page instead of detail page?

Post by Ted »

Oh, you know, I had a $variables = &$gCms->variables; at the top of the function.  I just assumed it was there before.  Apparently it wasn't.  :)
ganeshXL

Re: News Module: "more" links to admin page instead of detail page?

Post by ganeshXL »

kudos, this works indeed :)

thanks a lot!
Nicke

Re: News Module: "more" links to admin page instead of detail page?

Post by Nicke »

Thanks a lot! :D it works great now!
Locked

Return to “Modules/Add-Ons”