Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter miketm57

    (@miketm57)

    That did not seem to work… i had tried this before asking the question and it didnt work either…

    • This reply was modified 7 years, 2 months ago by miketm57.
    Thread Starter miketm57

    (@miketm57)

    public static function showUploadedFiles($postObject) {
    if ($postObject) {
    $path = self::$upload_path.$postObject->id.’/’;
    $url = self::$upload_url.$postObject->id.’/’;
    $uploads = maybe_unserialize($postObject->uploads);
    $uploadedFiles = ”;

    if (!empty($uploads) && is_dir($path)) {
    // Generate special message instead of file-list when hiding uploads for guests.
    if (!current_user_can(‘administrator’) && get_current_user_id() !== get_the_author()) {
    // TODO: Login link rendering can be put in own function.
    $uploadedFiles .= ‘

    • ‘.__(‘Only the author or administrators may view uploads.’, ‘asgaros-forum’).’
    • ‘;

      within ShowUploadedFiles

    Thread Starter miketm57

    (@miketm57)

    Ok, so this is my current statement
    if (!current_user_can(‘administrator’) && get_current_user_id() !== get_the_author())
    the administrator side is working, when you view with admin privileges it shows the uploads. This issue is the second part. I tried using get_the_author() to compare the current user to the post author but it doesn’t seem to be working. Is the syntax for that method incorrect?

    Thread Starter miketm57

    (@miketm57)

    Sorry I mostly do C# and am just looking at this for a friend and I think I misunderstood how he wanted this changed. I just talked with him and it seems rather what he is looking for is to change the method of is_user_logged_in to a is_author_or_admin. Do you have a link to the method is_user_logged_in so I can view that and create a modified copy of it to filter out all non-authors/nonadmins instead of guests.

Viewing 4 replies - 1 through 4 (of 4 total)