Advertisement:

Author Topic: SOLVED:{ADS} as $ads parameter in fn_alert_email_daily - from alert_email_daily  (Read 1259 times)

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Hello,
I can't figure out how to change/filter the item title from the <a ........>Item title</a> in the body of the alert_email_daily.

I analyzed the emails.php file but the function fn_alert_email_daily gets $ads as a parameter and I can't figure out the structure of it in order to change/filter the item title.

The reason is that I want to remove the underlines _ from the title, if any.

 I have a function that does that, I only need to know where to call it, and I think that if I know the structure of that $ads parameter, I can write a script that does that.

I gues that it retains the title and url of each ad, but how, with string keys or numeric keys and wich is for title?

I use 3.7.1.
« Last Edit: August 08, 2017, 03:57:35 pm by marius-ciclistu »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Or, does anyone know from where that $ads parameter is sent by a function call?
 I'm guesing that I can alter the title before it is sent as a parameter.
Thank you.

Liath

  • issues
  • Hero Member
  • *
  • Posts: 1346
  • </html> the end is always near
look at: oc-includes/osclass/alerts.php ~70

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Thank you. You are my hero:)
Now, if I have a function that removes the underline _ from the end of the less than 4 characters words, for example "and_" becomes "and" the code should be:

Code: [Select]
$ads .= '<a href="'. osc_item_url_ns($item['pk_i_id']).'">' . removeunderline($item['s_title']) . '</a><br/>';
And it works. Thank you again.
« Last Edit: June 27, 2017, 12:42:17 am by marius-ciclistu »

Liath

  • issues
  • Hero Member
  • *
  • Posts: 1346
  • </html> the end is always near
you could use str_replace() there...

Code: [Select]
str_replace("_", " ", $item['s_title']);

this will replace all _ with a blank space

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
EDIT: I use: $word=chop($word,"_").
I use that in my function. Now I noticed that if I input an email that is in the db of users (without being logged in) and save an alert, I receive an email with a validation link for user.
I let only loged in users to post ads, contact seller etc.

It's strange that that link is not working.
https://mysite.com/alert/confirm/11/secretcode/mail%40yahoo.com
is this happening because of my htaccess file or is it because the details I mentioned above?
« Last Edit: June 27, 2017, 12:56:21 am by marius-ciclistu »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Now I'm thinking of removing alerts for unlogged in users.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
I removed the posibility of unlogged in users to use alerts.
 I don't know if this is a bug or my htaccess messed up that link, but if only logged in users can post  ads/contact seller, it seems normal that unlogged in users should not have access to alerts.

in /oc-content/themes/bender/alert-form.php
I used the function osc_is_web_user_logged_in() to condition the showing of the subscribe alert button.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
OBS.
I activated the alert from osclass admin area (the validation link wasn't working as I said before).
The alert did not show in dashboard - alerts page of that email/user. But I did get the email that a new ad was posted according to my alert, on that email.

I noticed something similar if I posted an ad without an account, then if I created an account using the same email, I couldn't see the ad published before I made the account in my user dashboard, unless I edited that ad in osclass admin area and hit save(without changing it in any way). I gues the same issue happened with the alert.
« Last Edit: June 27, 2017, 12:53:21 am by marius-ciclistu »