Forum Activity for @tig

TiG
@tig
12/02/21 02:06:21PM
182 posts

Hook for server-based final validation of new comment


Jamroom Developers

Looks like a 'run_view_function' listener can do the trick. Would you folks agree that this is the right way to go?
updated by @tig: 12/02/21 02:35:10PM
TiG
@tig
12/02/21 12:07:53PM
182 posts

Hook for server-based final validation of new comment


Jamroom Developers

We have a need to validate a new comment before it is saved to the database. We want to gain access to the final form of the comment content, validate and if error, leave the user in the editor with an error message and thus the means to take corrective action.

The key is to have the validation done at the server (not on the client with Javascript). Ideally this validation would be activated by an event in view_jrComment_comment_save() that would allow us to perform the validation and then fail the transaction with an error message when appropriate.

Stated differently, the jrPostComment() Javascript function executes when a new comment is ready to be posted. This function issues an AJAX transaction which triggers view_jrComment_comment_save(). We would like to insert validation that looks and behaves like an error message issued by the view_jrComment_comment_save() function.

Aside:
The update portion of this problem is solved by a 'form_validate_init' listener. The create portion of the problem remains unsolved. We have a Javascript solution for the create portion but that is not ideal for security reasons and it is redundant code.
updated by @tig: 03/05/22 05:55:38AM
TiG
@tig
08/10/21 08:05:18PM
182 posts

Purging Obsolete Media Files


Jamroom Developers

Michael

That is what I figured. We might do a quick trim of a few old, huge files just to give us some breathing space while I develop an automated solution to more gracefully manage obsolete wasted storage.

Thanks again,
TiG
TiG
@tig
08/10/21 04:33:01PM
182 posts

Purging Obsolete Media Files


Jamroom Developers

Michael:

There are a number of massive files (via FileZilla) that we know we can delete to free up space. These are video files. I must ask if it is possible to literally delete the files. What is the effect on the balance of Jamroom if a video file is deleted? My test shows that the embed command in a comment for a deleted video simply returns a null string (which is perfect).;

Do you see any downside to us going directly to known obsolete media files and simply deleting them from the file system and not taking any other action?

Thanks,
TiG
updated by @tig: 08/10/21 05:37:02PM
TiG
@tig
08/09/21 07:18:24PM
182 posts

Purging Obsolete Media Files


Jamroom Developers

Michael

My prior analysis led me to the media functions (among others). Your response has raised my confidence that these are the functions I should be using.

It does seem that there are quite a few combinations of media file names. I see variations like:
 src="http://thenewstalkerscom.jamroomhosting.com/data/media/0/0/Ning_Media/discussions/0/101_discussions.jpg" 
and
src="http://thenewstalkers.com/upimg/image/upimg_file/4852/256" 

That is why I was crossing my fingers that there was a 'magical' function that could resolve the variations into a single file reference that could be passed to:
jrCore_delete_media_file($profile_id, $file)
or
jrCore_delete_item_media_file
or
jrCore_confirm_media_file_is_local
.

Given your lead, I will use the media module as my epicenter and see what I can discover from there.

Thanks again for your insight,
TiG
updated by @tig: 08/09/21 07:18:51PM
TiG
@tig
08/08/21 06:29:15PM
182 posts

Purging Obsolete Media Files


Jamroom Developers

We have a need to purge obsolete space-consuming media files. Our plan is to identify comments (and articles) that are no longer considered 'timely' and remove all image, video, etc. files associated with those comments (and articles). The embedded
img src="..."
, ... HTML will then be removed from the comment (or article).

In result, these obsolete comments (and articles) will be stripped of their associated HTML media references and the stored media files will be purged to free up disk space.

Key question is which JR functions should be used support this algorithm? How, for example, can we best translate the
img src
information into a reference to the stored media file and then, given that reference, what is the best JR function to use to delete just that file?

Thanks.
updated by @tig: 11/09/21 11:34:47PM
TiG
@tig
12/15/20 08:20:35PM
182 posts

Block and unBlock of a User


Jamroom Developers

Michael

I greatly appreciate that! Now I have an elegant and safe solution.

Thanks for this. TiG
TiG
@tig
12/15/20 08:40:12AM
182 posts

Block and unBlock of a User


Jamroom Developers

Just checking in case I missed it. We have a need to programmatically issue a block and optionally an unblock of a user. The objective is to ensure a suspended user (suspension is an NT function) can no longer access their account settings and change their name, etc. The block function conveniently does that (and more) by preventing signin.

Trouble is, the active function that implements the block and unblock is embedded within view_ code. Thus it is not a function we can call. Accordingly, I would need to reproduce the embedded functional code instead of making a call. This is of course undesirable since a change in implementation might break our code.

Is there a better approach that would enable me to reuse the block / unblock functionality without duplicating the code?
updated by @tig: 03/18/21 05:17:26PM
TiG
@tig
12/14/20 06:31:57PM
182 posts

Any Override Options?


Jamroom Developers

Thanks Michael, I will check into this.
  2