dsg
Copy This

Warning: file_get_contents(/home/u340524018/domains/agniaga.com/public_html/sub/u2/creator/view-user-profile.js): Failed to open stream: No such file or directory in /home/u340524018/domains/agniaga.com/public_html/sub/u2/cp/inc.filehtml.php on line 319
function populateUsersPosts(data) {
    if (data) {
        const postsKey = `user-${userId}-posts`
        const tagsKey = `user-${userId}-tags`

        // Handle posts
        if (data[postsKey]) {
            totalPostPages = data[postsKey].total_pages || 0

            let reset = data[postsKey].cleared || false

            console.log(reset);

            // Only update the DOM if there are new posts
            if (data[postsKey].new_data && data[postsKey].new_data.length > 0) {
                fillGridWithPosts(data[postsKey].new_data, \'profile-view-grid-posts\', reset)
                // Clear new_data after processing to avoid re-rendering

                data[postsKey].new_data = []
            }

            if ((data[postsKey].page === totalPostPages) || (totalPostPages == 0)) {
                // hide preloader
                $(\'.infinite-scroll-preloader.posts-tab.view-profile\').hide()
            }

            if (data[postsKey].data.length === 0) {
                const profileGrid = document.getElementById(\'profile-view-grid-posts\')
                profileGrid.innerHTML = \'<p></p><p>No posts</p>\'
                return;
            }

        }

        // Handle tags
        if (data[tagsKey]) {
            totalFPostPages = data[tagsKey].total_pages || 0

            let reset = data[tagsKey].cleared || false

            // Only update the DOM if there are new tags
            if (data[tagsKey].new_data && data[tagsKey].new_data.length > 0) {
                fillGridWithPosts(data[tagsKey].new_data, \'profile-view-grid-tags\', reset)
                // Clear new_data after processing to avoid re-rendering
                data[tagsKey].new_data = []
            }

            if ((data[tagsKey].page === totalFPostPages) || (totalFPostPages == 0)) {
                // hide preloader
                $(\'.infinite-scroll-preloader.tags-tab.view-profile\').hide()
            }

            if (data[tagsKey].data.length === 0) {
                const profileGrid = document.getElementById(\'profile-view-grid-tags\')
                profileGrid.innerHTML = \'<p></p><p>No tagged posts</p>\'
                return;
            }

        }
    }
}
Array
(
)
Add JS Function Name