HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: News

» Return to Contents



sources/news.php

Global_functions_news.php

Function summary

AUTO_LINK add_news_category (SHORT_TEXT title, ID_TEXT img, LONG_TEXT notes, ?MEMBER owner, ?AUTO_LINK id)
void edit_news_category (AUTO_LINK id, ?SHORT_TEXT title, ?SHORT_TEXT img, ?LONG_TEXT notes, ?MEMBER owner)
void delete_news_category (AUTO_LINK id)
AUTO_LINK add_news (SHORT_TEXT title, LONG_TEXT news, ?ID_TEXT author, BINARY validated, BINARY allow_rating, SHORT_INTEGER allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, LONG_TEXT news_article, ?AUTO_LINK main_news_category, ?array news_category, ?TIME time, ?MEMBER submitter, integer views, ?TIME edit_date, ?AUTO_LINK id, URLPATH image)
void edit_news (AUTO_LINK id, SHORT_TEXT title, LONG_TEXT news, ID_TEXT author, BINARY validated, BINARY allow_rating, SHORT_INTEGER allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, LONG_TEXT news_article, AUTO_LINK main_news_category, ?array news_category, SHORT_TEXT meta_keywords, LONG_TEXT meta_description, ?URLPATH image, ?TIME time)
void dispatch_news_notification (AUTO_LINK id, SHORT_TEXT title, AUTO_LINK main_news_category)
void delete_news (AUTO_LINK id)
tempcode nice_get_news_categories (?mixed it, boolean show_all_personal_categories, boolean addable_filter, boolean only_existing, ?boolean only_blogs, boolean prefer_not_blog_selected)
tempcode nice_get_news (?AUTO_LINK it, ?MEMBER only_owned, boolean editable_filter, boolean only_in_blog)

AUTO_LINK add_news_category(SHORT_TEXT title, ID_TEXT img, LONG_TEXT notes, ?MEMBER owner, ?AUTO_LINK id)

Add a news category of the specified details.

Parameters…

Name title
Description The news category title
Type SHORT_TEXT

Name img
Description The theme image ID of the picture to use for the news category
Type ID_TEXT

Name notes
Description Notes for the news category
Type LONG_TEXT

Name owner
Description The owner (NULL: public)
Default value
Type ?MEMBER

Name id
Description Force an ID (NULL: don't force an ID)
Default value
Type ?AUTO_LINK

Returns…

Description The ID of our new news category
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

void edit_news_category(AUTO_LINK id, ?SHORT_TEXT title, ?SHORT_TEXT img, ?LONG_TEXT notes, ?MEMBER owner)

Edit a news category.

Parameters…

Name id
Description The news category to edit
Type AUTO_LINK

Name title
Description The title (NULL: keep as-is)
Type ?SHORT_TEXT

Name img
Description The image (NULL: keep as-is)
Type ?SHORT_TEXT

Name notes
Description The notes (NULL: keep as-is)
Type ?LONG_TEXT

Name owner
Description The owner (NULL: public)
Default value
Type ?MEMBER

(No return value)


Return to the function index for this class Expand: View the source code to this function

void delete_news_category(AUTO_LINK id)

Delete a news category.

Parameters…

Name id
Description The news category to delete
Type AUTO_LINK

(No return value)


Return to the function index for this class Expand: View the source code to this function

AUTO_LINK add_news(SHORT_TEXT title, LONG_TEXT news, ?ID_TEXT author, BINARY validated, BINARY allow_rating, SHORT_INTEGER allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, LONG_TEXT news_article, ?AUTO_LINK main_news_category, ?array news_category, ?TIME time, ?MEMBER submitter, integer views, ?TIME edit_date, ?AUTO_LINK id, URLPATH image)

Adds a news entry to the database, and send out the news to any RSS cloud listeners.

Parameters…

Name title
Description The news title
Type SHORT_TEXT

Name news
Description The news summary (or if not an article, the full news)
Type LONG_TEXT

Name author
Description The news author (possibly, a link to an existing author in the system, but does not need to be) (NULL: current username)
Default value
Type ?ID_TEXT

Name validated
Description Whether the news has been validated
Default value 1
Type BINARY

Name allow_rating
Description Whether the news may be rated
Default value 1
Type BINARY

Name allow_comments
Description Whether comments are allowed (0=no, 1=yes, 2=review style)
Default value 1
Type SHORT_INTEGER

Name allow_trackbacks
Description Whether the news may have trackbacks
Default value 1
Type BINARY

Name notes
Description Notes for the news
Default value
Type LONG_TEXT

Name news_article
Description The news entry (blank means no entry)
Default value
Type LONG_TEXT

Name main_news_category
Description The primary news category (NULL: personal)
Default value
Type ?AUTO_LINK

Name news_category
Description The IDs of the news categories that this is in (NULL: none)
Default value
Type ?array

Name time
Description The time of submission (NULL: now)
Default value
Type ?TIME

Name submitter
Description The news submitter (NULL: current member)
Default value
Type ?MEMBER

Name views
Description The number of views the article has had
Default value 0
Type integer

Name edit_date
Description The edit date (NULL: never)
Default value
Type ?TIME

Name id
Description Force an ID (NULL: don't force an ID)
Default value
Type ?AUTO_LINK

Name image
Description URL to the image for the news entry (blank: use cat image)
Default value
Type URLPATH

Returns…

Description The ID of the news just added
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

void edit_news(AUTO_LINK id, SHORT_TEXT title, LONG_TEXT news, ID_TEXT author, BINARY validated, BINARY allow_rating, SHORT_INTEGER allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, LONG_TEXT news_article, AUTO_LINK main_news_category, ?array news_category, SHORT_TEXT meta_keywords, LONG_TEXT meta_description, ?URLPATH image, ?TIME time)

Edit a news entry.

Parameters…

Name id
Description The ID of the news to edit
Type AUTO_LINK

Name title
Description The news title
Type SHORT_TEXT

Name news
Description The news summary (or if not an article, the full news)
Type LONG_TEXT

Name author
Description The news author (possibly, a link to an existing author in the system, but does not need to be)
Type ID_TEXT

Name validated
Description Whether the news has been validated
Type BINARY

Name allow_rating
Description Whether the news may be rated
Type BINARY

Name allow_comments
Description Whether comments are allowed (0=no, 1=yes, 2=review style)
Type SHORT_INTEGER

Name allow_trackbacks
Description Whether the news may have trackbacks
Type BINARY

Name notes
Description Notes for the news
Type LONG_TEXT

Name news_article
Description The news entry (blank means no entry)
Type LONG_TEXT

Name main_news_category
Description The primary news category (NULL: personal)
Type AUTO_LINK

Name news_category
Description The IDs of the news categories that this is in (NULL: do not change)
Type ?array

Name meta_keywords
Description Meta keywords
Type SHORT_TEXT

Name meta_description
Description Meta description
Type LONG_TEXT

Name image
Description URL to the image for the news entry (blank: use cat image) (NULL: don't delete existing)
Type ?URLPATH

Name time
Description Recorded add time (NULL: leave alone)
Default value
Type ?TIME

(No return value)


Return to the function index for this class Expand: View the source code to this function

void dispatch_news_notification(AUTO_LINK id, SHORT_TEXT title, AUTO_LINK main_news_category)

Send out a notification of some new news.

Parameters…

Name id
Description The ID of the news
Type AUTO_LINK

Name title
Description The title
Type SHORT_TEXT

Name main_news_category
Description The main news category
Type AUTO_LINK

(No return value)


Return to the function index for this class Expand: View the source code to this function

void delete_news(AUTO_LINK id)

Delete a news entry.

Parameters…

Name id
Description The ID of the news to edit
Type AUTO_LINK

(No return value)


Return to the function index for this class Expand: View the source code to this function

tempcode nice_get_news_categories(?mixed it, boolean show_all_personal_categories, boolean addable_filter, boolean only_existing, ?boolean only_blogs, boolean prefer_not_blog_selected)

Get a nice formatted XHTML list of news categories.

Parameters…

Name it
Description The selected news category. Array or AUTO_LINK (NULL: personal)
Default value
Type ?mixed

Name show_all_personal_categories
Description Whether to add all personal categories into the list (for things like the adminzone, where all categories must be shown, regardless of permissions)
Default value boolean-false
Type boolean

Name addable_filter
Description Whether to only show for what may be added to by the current member
Default value boolean-false
Type boolean

Name only_existing
Description Whether to limit to only existing cats (otherwise we dynamically add unstarted blogs)
Default value boolean-false
Type boolean

Name only_blogs
Description Whether to limit to only show blog categories (NULL: don't care, true: blogs only, false: no blogs)
Default value
Type ?boolean

Name prefer_not_blog_selected
Description Whether to prefer to choose a non-blog category as the default
Default value boolean-false
Type boolean

Returns…

Description The tempcode for the news category select list
Type tempcode

Return to the function index for this class Expand: View the source code to this function

tempcode nice_get_news(?AUTO_LINK it, ?MEMBER only_owned, boolean editable_filter, boolean only_in_blog)

Get a nice formatted XHTML list of news.

Parameters…

Name it
Description The selected news entry (NULL: none)
Type ?AUTO_LINK

Name only_owned
Description Limit news to those submitted by this member (NULL: show all)
Default value
Type ?MEMBER

Name editable_filter
Description Whether to only show for what may be edited by the current member
Default value boolean-false
Type boolean

Name only_in_blog
Description Whether to only show blog posts
Default value boolean-false
Type boolean

Returns…

Description The list
Type tempcode

Return to the function index for this class Expand: View the source code to this function

sources/newsletter.php

Global_functions_newsletter.php

Function summary

string basic_newsletter_join (EMAIL email, integer interest_level, ?LANGUAGE_NAME lang, boolean get_confirm_mail, ?AUTO_LINK newsletter_id, string forename, string surname)
void actual_send_newsletter (LONG_TEXT message, SHORT_TEXT subject, LANGUAGE_NAME lang, array send_details, BINARY html_only, string from_email, string from_name, integer priority, string csv_data, ID_TEXT mail_template)
array newsletter_who_send_to (array send_details, LANGUAGE_NAME lang, integer start, integer max, boolean get_raw_rows, string csv_data)
string newsletter_variable_substitution (string message, SHORT_TEXT subject, SHORT_TEXT forename, SHORT_TEXT surname, SHORT_TEXT name, EMAIL email_address, ID_TEXT sendid, SHORT_TEXT hash)
void newsletter_shutdown_function ()
AUTO_LINK add_newsletter (SHORT_TEXT title, LONG_TEXT description)
void edit_newsletter (AUTO_LINK id, SHORT_TEXT title, LONG_TEXT description)
void delete_newsletter (AUTO_LINK id)

string basic_newsletter_join(EMAIL email, integer interest_level, ?LANGUAGE_NAME lang, boolean get_confirm_mail, ?AUTO_LINK newsletter_id, string forename, string surname)

Add to the newsletter, in the simplest way.

Parameters…

Name email
Description The email address of the subscriber
Type EMAIL

Name interest_level
Description The interest level
Default value 4
Type integer
Value range 1 4

Name lang
Description The language (NULL: users)
Default value
Type ?LANGUAGE_NAME

Name get_confirm_mail
Description Whether to require a confirmation mail
Default value boolean-false
Type boolean

Name newsletter_id
Description The newsletter to join (NULL: the first)
Default value
Type ?AUTO_LINK

Name forename
Description Subscribers forename
Default value
Type string

Name surname
Description Subscribers surname
Default value
Type string

Returns…

Description Newsletter password
Type string

Return to the function index for this class Expand: View the source code to this function

void actual_send_newsletter(LONG_TEXT message, SHORT_TEXT subject, LANGUAGE_NAME lang, array send_details, BINARY html_only, string from_email, string from_name, integer priority, string csv_data, ID_TEXT mail_template)

Send out the newsletter.

Parameters…

Name message
Description The newsletter message
Type LONG_TEXT

Name subject
Description The newsletter subject
Type SHORT_TEXT

Name lang
Description The language
Type LANGUAGE_NAME

Name send_details
Description A map describing what newsletters and newsletter levels the newsletter is being sent to
Type array

Name html_only
Description Whether to only send in HTML format
Default value 0
Type BINARY

Name from_email
Description Override the email address the mail is sent from (blank: staff address)
Default value
Type string

Name from_name
Description Override the name the mail is sent from (blank: site name)
Default value
Type string

Name priority
Description The message priority (1=urgent, 3=normal, 5=low)
Default value 3
Type integer
Value range 1 5

Name csv_data
Description CSV data of extra subscribers (blank: none). This is in the same ocPortal newsletter CSV format that we export elsewhere.
Default value
Type string

Name mail_template
Description The template used to show the email
Default value MAIL
Type ID_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

array newsletter_who_send_to(array send_details, LANGUAGE_NAME lang, integer start, integer max, boolean get_raw_rows, string csv_data)

Find a group of members the newsletter will go to.

Parameters…

Name send_details
Description A map describing what newsletters and newsletter levels the newsletter is being sent to
Type array

Name lang
Description The language
Type LANGUAGE_NAME

Name start
Description Start position in result set (results are returned in parallel for each category of result)
Type integer

Name max
Description Maximum records to return from each category
Type integer

Name get_raw_rows
Description Whether to get raw rows rather than mailer-ready correspondance lists
Default value boolean-false
Type boolean

Name csv_data
Description Serialized CSV data to also consider
Default value
Type string

Returns…

Description Returns a tuple of corresponding detail lists, emails,hashes,usernames,forenames,surnames,ids, and a record count for levels (depending on requests: csv, 1, <newsletterID>, g<groupID>) [record counts not returned if $start is not zero, for performance reasons]
Type array

Return to the function index for this class Expand: View the source code to this function

string newsletter_variable_substitution(string message, SHORT_TEXT subject, SHORT_TEXT forename, SHORT_TEXT surname, SHORT_TEXT name, EMAIL email_address, ID_TEXT sendid, SHORT_TEXT hash)

Sub in newsletter variables.

Parameters…

Name message
Description The original newsletter message
Type string

Name subject
Description The newsletter subject
Type SHORT_TEXT

Name forename
Description Subscribers forename (blank: unknown)
Type SHORT_TEXT

Name surname
Description Subscribers surname (blank: unknown)
Type SHORT_TEXT

Name name
Description Subscribers name (or username)
Type SHORT_TEXT

Name email_address
Description Subscribers email address
Type EMAIL

Name sendid
Description Specially encoded ID of subscriber (begins either 'n' for newsletter subscriber, or 'm' for member - then has normal subscriber/member ID following)
Type ID_TEXT

Name hash
Description Double encoded password hash of subscriber (blank: can not unsubscribe by URL)
Type SHORT_TEXT

Returns…

Description The new newsletter message
Type string

Return to the function index for this class Expand: View the source code to this function

void newsletter_shutdown_function()

Actually send out the newsletter in the background.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

AUTO_LINK add_newsletter(SHORT_TEXT title, LONG_TEXT description)

Make a newsletter.

Parameters…

Name title
Description The title
Type SHORT_TEXT

Name description
Description The description
Type LONG_TEXT

Returns…

Description The ID
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

void edit_newsletter(AUTO_LINK id, SHORT_TEXT title, LONG_TEXT description)

Edit a newsletter.

Parameters…

Name id
Description The ID
Type AUTO_LINK

Name title
Description The title
Type SHORT_TEXT

Name description
Description The description
Type LONG_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

void delete_newsletter(AUTO_LINK id)

Delete a newsletter.

Parameters…

Name id
Description The ID
Type AUTO_LINK

(No return value)


Return to the function index for this class Expand: View the source code to this function