Isn't it possible to favorite a custom page?

Post date: 2020-12-01 16:51:14
Views: 180

Favorite button only appears on question pages, tag pages, category pages and user pages. It seems that there is no value nor key for the favorite elements in custom pages.

$this->content'favorite'] = null

Is there a way to insert that "favorite" element into the content array, or how can you enable favorite feature in custom pages?

Example of the favorite element in a tag page:

if (isset($userid) && isset($tagword)) {
    $favoritemap = qa_get_favorite_non_qs_map();
    $favorite = @$favoritemap'tag']qa_strtolower($tagword'word'])];

    $qa_content'favorite'] = qa_favorite_form(QA_ENTITY_TAG, $tagword'wordid'], $favorite,
        qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'main/add_tag_x_favorites', $tagword'word']));
}

I tried putting this into https://github.com/q2a/question2answer/blob/1f39ae44adf42c83042be631e39373893a3ec969/qa-include/pages/default.php#L67

$userid = qa_get_logged_in_userid();       
if (isset($userid)){
    $qa_content'favorite'] = qa_favorite_form(QA_ENTITY_NONE, $custompage'pageid'], $favorite, qa_lang($favorite ? 'Unfolow' : 'Follow'));
}

but I got the error message

Unexpected response from server - please try again or switch off Javascript.

So, there must be some extra steps, I think.

Please click Here to read the full story.
 
Other Top and Latest Questions:
Bumble jumps 26% as dating company plans to axe 30% of workforce
What would you have done, baby bird question #62
Microphone doesn't work in Chrome when using FB Messenger
What's next as the British pound hits its highest in more than three years?
California Gov. Gavin Newsom sues Fox News for $787 million, alleging defamation
Stocks making the biggest moves midday: Nike, Uber, Newmont, Trade Desk and more
What we know so far about Jeff Bezos' $50 million star-studded luxury Venice wedding
Analysts like these beaten-down stocks heading into the second half of 2025
To land Meta’s massive $10 billion data center, Louisiana pulled out all the stops. Will it be worth it?
Despite promise to remove 'worst of the worst,' ICE has arrested only 6% of known immigrant murderers