Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

PHP Newb. Please Halp!

Re: PHP Newb. Please Halp!

Yes it make sens of course...

Sorry it was my fault...I make some confusion because I test your stuff very later this night and I was very tired....

Now all work fine...

Many thank for your great module and support.. To thank you I just wrote a review on the JED...

dotcom22
Junior Modder
ranks
useravatar
Offline
21 Posts
Administrator has disabled public posting

Re: PHP Newb. Please Halp!

Hello again Stephen

please I have another question but this one is maybe little bit more tricky...

I would like show a specific module based on the fact if a user own or not a featured Jrereview listing (a listing is in fact a Joomla article because Jreview is based on core Joomla article).

So in practice that mean:

- User is recognized to be a featured listing owner = Module is displayed
- User is recognized to be a non-featured listing owner = Module is not displayed

It seem making this is possible by putting a mix of Jreview recipe code and a Author recipe code... Unfortunately I'm not a php coder and I'm unable to know how to do...

Can you please point me to the right direction? If you can provide me the adapted recipe I can test on my side and tell you if that work...

Many thank

Cheers

dotcom22
Junior Modder
ranks
useravatar
Offline
21 Posts
Administrator has disabled public posting

Re: PHP Newb. Please Halp!

hello Stephen

please can you reply to my request?

thank

dotcom22
Junior Modder
ranks
useravatar
Offline
21 Posts
Administrator has disabled public posting

Re: PHP Newb. Please Halp!

ok, so you want something like this:

- A person is looking at a listing (article)
- it's their own article (they are logged in, and are the author)
- the listing is "featured".
- if all of those are true, then show a particular module.

Correct?

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: PHP Newb. Please Halp!

Yes...It is correct except one thing: The user can look everywhere on the site and not only at articles. That mean it must be recognized immediately at login to be a "User Author Featured Listing". If this condition match a specific module is displayed..

Many thank for your time...

dotcom22
Junior Modder
ranks
useravatar
Offline
21 Posts
Administrator has disabled public posting

Re: PHP Newb. Please Halp!

Oh, so you're saying that you want a module to appear on any page, based on whether the logged-in user has any featured JReview articles on the site.

Ok, try this:

if ($user->id > 0) {
  $userid = (int)$user->id;
  $query = "select count(jrc.featured) from #__jreviews_content jrc, #__content c where c.id = jrc.contentid and jrc.featured = 1 and c.created_by = $userid";
  $db->setQuery($query);
  $result = $db->loadResult();
  // replace XXX with module id to return if author has a featured listing:
  if ($result > 0) return XXX;
}

I tested this - works for me.
Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: PHP Newb. Please Halp!

Beautiful!!! Your recipe work like a charm :-) Thank 1000 time!!!


However I'm sorry but I would like enhance a little bit this recipe (If I dare to ask you without abuse)...


In fact after reflection and for some specific case, instead to not show module to non-featured Jreview listing owner, I would like show another module...

In practice that mean:

- User is recognized to be a featured listing owner = Module number 123 is displayed

- User is recognized to be a non-featured listing owner = Module 321 is displayed

I take a look to some of your others recipes for try to identify the PHP code to include for do that, but is very hard when you are not a coder :-(

If you can help again is very nice...

cheers

dotcom22
Junior Modder
ranks
useravatar
Offline
21 Posts
Administrator has disabled public posting

Re: PHP Newb. Please Halp!

Hi dotcom22,

don't worry, I never abuse the people who use my software! You guys help me pay my bills, and in any case I want to help you with your Joomla module and template issues...

So let's modify the recipe above a little.

if ($user->id > 0) {
  $userid = (int)$user->id;
  $query = "select " .
    " ( select count(jrc.featured) from #__jreviews_content jrc, " .
    " #__content c where c.id = jrc.contentid and jrc.featured = 1 " .
    " and c.created_by = $userid) as feat, " .
    " ( select count(jrc.featured) from #__jreviews_content jrc, " .
    " #__content c where c.id = jrc.contentid and jrc.featured = 0 " .
    " and c.created_by = $userid) as nonfeat ";
  $db->setQuery($query);
  $result = $db->loadObject();
  if ($result == null) return; // short-circuit if there was an error

  // replace XXX with module id to return if author has a featured listing,
  // and YYY with module if to return if they have listings that are not featured:

  if ($result->feat > 0) return XXX; // if they have featured articles
  if ($result->nonfeat > 0) return YYY; // if they have non-featured articles
}

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: PHP Newb. Please Halp!

Beautiful Stephen thank a lot it work well!!!!!!!!big_smilebig_smilelollolcoolcool

I don't have fully fully tested but it seem no problem...Actually I'm always under development and my site will not be ready before some months...

To be honest right now I don't have purchase nothing...but I plan to buy soon your metamod pro because I will probably need it for avoid possible gap with my template even if right now all seem to be ok about that..

I suggest to you to place in your "Jreview recipe page" the severals one you describe me in this post for avoid you the hassle to reply to some other Jreviews user like me... Much probably some other users will need it because even if is the best Review component for Joomla, Jreview is not very flexible about the fact to hide/show stuff according to featured/non-featured listing...

All the best

cheers

PS: I submit few days ago a review in the JED but it is not again approved...need to wait some more days I imagine..

dotcom22
Junior Modder
ranks
useravatar
Offline
21 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1687
Total Polls:
6
Total Posts:
5939
Dormant:
User Info:
 
Total Users:
6578
Newest User:
jessicaeatock
Members Online:
0
Guests Online:
100

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked