Clipboard Download version 2.1

5.0
Dutch eric redegeld 2 months ago

The Clipboard module is an extension for the Open Source Social Network (OSSN) that allows users to generate an overview of their activity on the platform, including:

Timeline Posts: A list of posts made by the user, including any attached images and comments.
Comments: Comments on posts are displayed separately and structured.
Blogs: An overview of blogs written by the user, including links to the original blog posts.
Download Functionality: Users can download their data as a text file for personal archiving or backup purposes.

This module is ideal for users who want to maintain an archive of their social media activity and easily download it for personal use.

Comments
Dutch Eric redegeld Replied 4 weeks ago

good advise, add this in next update

German Michael Zülsdorff Replied 4 weeks ago

Yeah, not very likely, but the same will happen if OssnWall is disabled.

Thus, whenever accessing a class or a function which isn't guaranteed to be available, do a check in advance like

if (com_is_active('COMPONENT_NAME_TO_BE_CHECKED')) {
           // proceed ... 
}

or if your component basically makes no sense at all without another component installed and enabled
then add that dependency to the xml file and use this hook:

ossn_add_hook('required', 'components', 'FUNCTION_TO_ADD_REQUIRED_COMS');

as done in Pinned Posts for example which needs a working wall, too.

Dutch Eric redegeld Replied 4 weeks ago

Thank you Dominik L for point to this error.

Changes Made
Bug Fix: Missing Blog Class Handling

Added a check in clipboardfetchuser_data() to verify if the Blog class exists before using it.
If the Blog class is unavailable (e.g., the Blogs component is not installed), the code logs a warning and gracefully defaults to an empty list of blogs. This prevents crashes in environments without the Blogs component.
Improved Fallback Logic

Ensured that the Clipboard component remains functional even when optional dependencies, like the Blogs component, are missing.
Enhanced Debugging

Added errorlog statements to provide useful debugging information when:
Posts or comments contain invalid data.
The Blog class is missing or unavailable.
Updated ossn
com.php

Improved the structure and readability of the file.
Added robust error handling for unexpected situations (e.g., missing GUIDs or invalid objects).
Updated component.xml

Bumped the component version to 2.1 to reflect the latest updates.
Enhanced the description to better communicate the component’s purpose and functionality.
Retained the MIT license, which allows free use, modification, and distribution with attribution.

Dutch Eric redegeld Replied 4 weeks ago

found it, it now crached on the missing blog.

testing now and when not active or present to get this line now

Blogs
The Blogs component is not installed or activated.

Dutch Eric redegeld Replied 4 weeks ago

Ow weird. I wil look in to this

German Dominik L Replied 4 weeks ago

I am getting this error, when trying to access clipboard

Error: Class "Blog" not found in /var/www/queermeet/htdocs/mrcrossii/DEVELOPER/components/Clipboard/ossn_com.php:96
Stack trace:
#0 /var/www/queermeet/htdocs/mrcrossii/DEVELOPER/components/Clipboard/ossn_com.php(74): clipboard_fetch_user_data()
#1 /var/www/queermeet/htdocs/mrcrossii/DEVELOPER/libraries/ossn.lib.page.php(79): clipboard_page_handler()
#2 /var/www/queermeet/htdocs/mrcrossii/DEVELOPER/index.php(22): ossn_load_page()
#3 {main}
Dutch Eric redegeld Replied 2 months ago

Changelog for Clipboard Module - Version 2.0
Release Date: November 28, 2024

New Features:
Profile Tab Integration

Added a new tab under "Edit Profile" to provide users with a dedicated interface to access their Clipboard data directly from their account settings.
Introduced a profile_tab.php file for rendering the interface with buttons to view or download user data.
Improved User Data Download

Enhanced the download functionality to include timeline posts and their associated comments.
Added error handling to gracefully skip comments with invalid GUIDs.
Role-based Data Access

Ensured that:
Regular users can only view or download their own data.
Admin users can view and download data for any user.
Added access checks to prevent unauthorized access.

Changes:
Modularized CSS

Updated Clipboard/css/clipboard.php to improve style consistency across the module.
Menu and Navigation Updates

Removed the Clipboard link from the top and left navigation bar.
Added a contextual menu item under "Edit Profile" using the ossnaddhook system. conform GPDR
Enhanced Logging

Added debug logs for invalid comments and other potential data inconsistencies during download.
Bug Fixes:
Fixed issues with comments not being displayed correctly during data download.
Resolved errors when fetching user data without proper validation.
Upgrade Instructions:
Replace the existing ossncom.php with the new version.
Add the profile
tab.php file to the plugins/default/clipboard directory.
Ensure the CSS file clipboard.php is updated in Clipboard/css/.
Known Issues:
Some comments with missing GUIDs may still trigger warnings in error logs.
Additional error handling improvements planned for future releases.

Contributors:
Special thanks to Michael Zülsdorff for feedback and testing, ensuring this release meets user needs effectively.

Dutch Eric redegeld Replied 2 months ago

Mischael, great feedback
think i got it working

https://shadow.nlsociaal.nl/home

German Michael Zülsdorff Replied 2 months ago

Next I'd suggest to surround that line like

if (ossn_isAdminLoggedin()) {
    $user = $username ? ossn_user_by_username($username) : ossn_loggedin_user();
} else {
    $user = ossn_loggedin_user();
}

because otherwise any user may collect any user's data ;)

And since all this belongs to the member's personal data anyway, I would make it part of the "Edit Profile" page like
enter image description here

(The GDPR component shows which way to create an entry like that)

German Michael Zülsdorff Replied 2 months ago

Some changes ... just having a first brief look ...

define('__CLIPBOARD__', ossn_route()->com . 'Clipboard/');

remember that Unix file and directory names are case-sensitive
and your component gets installed as Clipboard - not clipboard


ossn_extend_view('css/ossn.default', 'clipboard/css/clipboard');

Ossn expects css files included like this to be PHP executables (allowing to use some vars) - so rename it to clipboard.php


/*
echo ossn_set_page_layout('contents', array(
    'content' => $content,
    'title' => $title,
));
*/

Have a look into themes/goblue/plugins/default/theme/page/layout/contents.php:
It's dealing with content only, thus it makes no sense to pass a title parameter. And if you don't want a standalone page but include it (as shown in the screenshot) the complete change is:

$page = ossn_set_page_layout('contents', array(
    'content' => $content,
));
echo ossn_view_page($title, $page);

Component

Developer: eric
License Expat (MIT)
Type: User admin
Requires Ossn Version : 6.6
Latest Version: version 2.1
Last Updated 4 weeks ago
Repository Url View Repository

Versions