First off, i'm a complete newbie hack (otherwise known as a "Flash guy").

With that out of the way, i'd like to pose this question:

In each user's profile, i'm trying to get a block to show embedded videos (YouTube and the like). I created a custom content type called "embedvideos" that is basically just a title field and a "paste embed code here" field (i have full html input specified as default).

Question - could someone help me with the required php to place in the new block i'm creating? Basically, it just needs to reference the content page the user created from the embedvideos content submission form, and show up in a block at the bottom of the page.

The site i'm working on, btw, is www.gladiatorg.com/community .

Thanks!

Paul

Comments

coreyp_1’s picture

Just use the Views contrib. module, then you don't have to mess with php.

- Corey

pableaux’s picture

...and i'm lost. My problem seems just out of reach...i'm so close. I have the content type submitting and working perfectly. I just can't figure out how to display it where I need to...that being in a block at the bottom of each user's profile.

Thank you for the suggestion, by the way...

P.

coreyp_1’s picture

First things first. Have you been able to set up a view to pull the information that you need?

- Corey

pableaux’s picture

...and I think that's where I'm stuck. Once I know how to pull it, then i'm pretty sure i can get it in a block that's viewed by user/*

P.

coreyp_1’s picture

Here's how it should go:

  1. Create a view, and fill out the Basic Information.
  2. Expand the "Block" area, and check the "Provide Block" option. Fill out the rest of the information under "Block" however you want.
  3. Expand the "Fields" area, and add the fields that you want to be displayed.
  4. Expand the "Arguments" area. This is where the work is done:
    • Add the argument "User: UID is Author".
    • Set "Default" to "Use Empty Text".
    • Expand the "Argument Handling Code" area, and insert this code:
      if ( ($type=='block') && is_numeric(arg(1)) ){
      $args[0] = arg(1);
      }
      return $args;
      

      This code is necessary when the view is displayed in a block (per this comment).

  5. Expand the "Filters" area. You will probably want to add a filter to only show published nodes.
  6. You may wish to expand the "Sort Criteria" area to give order to the view.
  7. Save!!!
  8. Go to the Blocks Administration page (admin/build/block), and enable the block.

Let's see if that gets your view going.

- Corey

pableaux’s picture

But now, i get the following error message at the "content top" of every page:

user warning: You have an error in your SQL syntax near 'LIMIT 0, 10' at line 1 query: LIMIT 0, 10 in /var/www/vhosts/gladiatorg.com/httpdocs/community/includes/database.mysql.inc on line 172.

Also, the block is pulling in photos from the "My Photos" block i created earlier. Hey - at least i'm closer than before...

P.

pableaux’s picture

But now, i get the following error message at the "content top" of every page:

user warning: You have an error in your SQL syntax near 'LIMIT 0, 10' at line 1 query: LIMIT 0, 10 in /var/www/vhosts/gladiatorg.com/httpdocs/community/includes/database.mysql.inc on line 172.

Also, the block is pulling in photos from the "My Photos" block i created earlier. Hey - at least i'm closer than before...

P.

coreyp_1’s picture

That's odd.

According to that error, your SQL statement is almost non-existent. Are you sure that you added the fields to be viewed in step 3?

- Corey