Automatic OSSN Wall Update in Home Page

Druskus ZoneNations Posted in Technical Support 2 months ago

I would like OSSN Wall to update automatically on the home page with each new post.
I am looking at the file:
components/OssnWall/plugins/default/js/ossn_Wall.php
which seems to me to be the correct one, and I would like to add this portion of code:

function ossn_wall_init() {
    $(document).ready(function() {
        // Automatically update the wall every few seconds
        setInterval(function() {
            // Make an AJAX request to retrieve new posts
            $.ajax({
                url: 'URL_OF_YOUR_ENDPOINT_TO_RETRIEVE_THE_UPDATED_POSTS',
                type: 'GET',
                dataType: 'json',
                success: function(response) {
                    // Update the home page with the new posts
                    $('.user-activity').prepend(response.html); // Assuming that 'response.html' contains the markup of the new posts
                },
                error: function(xhr, status, error) {
                    console.error('Error while retrieving new posts:', error);
                }
            });
        }, 60000); // Refresh every 60 seconds (you can change the interval as you like)
    });
}

I haven't tested the code yet, but I wanted to ask if you think it is feasible? Also I would ask if it would be possible to have the URL of the endpoint which I can't figure out what it is and 'response.html' with the actual response from your endpoint that contains the HTML markup of the new posts.

In case the code is correct, would it be possible to include it in the official versions of OSSN Wall?

Replies
Italian Druskus ZoneNations Replied 2 months ago

guys be careful don't use my code, it blocks the site functions of the various menus. I ask if it is possible to delete or hide my code in order to avoid someone messing up their site because of me

Indonesian Arsalan Shah Replied 2 months ago

Following

var wall_home = Ossn.site_url + 'home';

.

Italian Druskus ZoneNations Replied 2 months ago

no, but it is not code developed by me

Indonesian Arsalan Shah Replied 2 months ago

Are you using chatGPT?