Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-09-07 22:50:51

albatros69
Member
Registered: 2021-06-17
Posts: 21

Strange behavior of permlinkurl in article_saved callback

Hello all,

I’m using permlinkurl in an article_saved callback, using the $rs I received. The URL format for this site is year_month_day_title.
The issue I have is that $rs doesn’t contain a value for Posted or uPosted, as expected by permlinkurl to fill in the date fields: only $rs['sPosted'] is set. Then, the url ends up like https://<main_domain>////<title>, which points to the main page of the site, and not the article.

Is it an expected behavior?
I could of course use permlinkurl_id instead but that would seem overkill as I already have the record set. I could also add the necessary field values to $rs but I prefer to check if I’m not missing something…

Thanks in advance for your help,
Regards,

Last edited by albatros69 (2021-09-07 23:11:10)

Offline

#2 2021-09-08 08:34:35

etc
Developer
Registered: 2010-11-11
Posts: 5,186
Website GitHub

Re: Strange behavior of permlinkurl in article_saved callback

albatros69 wrote #331540:

The issue I have is that $rs doesn’t contain a value for Posted or uPosted, as expected by permlinkurl to fill in the date fields: only $rs['sPosted'] is set.

Is it an expected behavior?
I could of course use permlinkurl_id instead but that would seem overkill as I already have the record set. I could also add the necessary field values to $rs but I prefer to check if I’m not missing something…

That’s kind of expected, since $rs here contains only (some) incoming form fields, namely

    'ID',
    'Title',
    'Body',
    'Excerpt',
    'textile_excerpt',
    'Image',
    'textile_body',
    'Keywords',
    'description',
    'Status',
    'Posted',
    'Expires',
    'Section',
    'Category1',
    'Category2',
    'Annotate',
    'AnnotateInvite',
    'publish_now',
    'reset_time',
    'expire_now',
    'AuthorID',
    'sPosted',
    'LastModID',
    'sLastMod',
    'override_form',
    'year',
    'month',
    'day',
    'hour',
    'minute',
    'second',
    'url_title',
    'exp_year',
    'exp_month',
    'exp_day',
    'exp_hour',
    'exp_minute',
    'exp_second',
    'sExpires',

plus custom_n fields. So feel free to add $rs['uPosted'] as you see fit (sPosted might work).

Then, the url ends up like https://<main_domain>////<title>, which points to the main page of the site, and not the article.

This is less normal, since it should use the current date in this case.

Offline

#3 2021-09-08 10:44:00

albatros69
Member
Registered: 2021-06-17
Posts: 21

Re: Strange behavior of permlinkurl in article_saved callback

etc wrote #331543:

This is less normal, since it should use the current date in this case.

Could it be because $rs['Posted'] exists but is empty?

Offline

#4 2021-09-08 11:11:42

etc
Developer
Registered: 2010-11-11
Posts: 5,186
Website GitHub

Re: Strange behavior of permlinkurl in article_saved callback

albatros69 wrote #331544:

Could it be because $rs['Posted'] exists but is empty?

Ah, thanks, haven’t noticed it. So date() yields a fatal error, swallowed in async mode.

Offline

Board footer

Powered by FluxBB