News:

Wondering if this will always be free?  See why free is better.

Main Menu

Download System

Started by Texan78, May 15, 2012, 01:20:05 PM

Previous topic - Next topic

Texan78

Hello,

I am using this mod http://custom.simplemachines.org/mods/index.php?mod=992 and it is exactly what I need but I need a small tweak that I was wondering if it was possible and if someone could offer some assistance with. 

What I am looking for is when a download is created it will create a post in a certain board I choose with the topic being the downloads title, but the first post contents will be that of the downloads description.


Any way this can be done?

-Thanks!


vbgamer45

That should mostly be built already inside that mod. Under edit category you have the option to choose which board to post to.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Texan78

Thank you for the quick response. My apologizes, I think I described it wrong. You are correct, you can set it to post to certain board. As it is now unless there is something I am missing it only posts a link in that post to the downloads section. If possible it would be really really nice for it to also post the description of the download in addition of the link to the download below it. How would this be possible?

-Thanks!

vbgamer45

Modify the Downloads.php in the Sources folder look at the AddDownload2 function and find the createpost function and add have it include the description of the download into  message body of that function call
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Texan78

Whewww, I'm not a coder so that may be a tad over my expertise, but I can find my way around ok so I will give it a shot since I have some direction now. Please stand by and I will update with the progress if I was able to get it..LoL

-Thanks!

Texan78

Would this be the Downloads2.php? I don't have a Downloads.php in my Sources folder?

-Thanks

Texan78

Quote from: vbgamer45 on May 15, 2012, 06:59:57 PM
Modify the Downloads.php in the Sources folder look at the AddDownload2 function and find the createpost function and add have it include the description of the download into  message body of that function call

Here is the AddDownload two function but I can not fine the createpost function.

function Downloads_AddDownload()
{
global $context, $mbname, $txt, $modSettings, $user_info, $smcFunc, $sourcedir;

isAllowedTo('downloads_add');

if (isset($_REQUEST['cat']))
$cat = (int) $_REQUEST['cat'];
else
$cat = 0;

$context['down_cat'] = $cat;

Downloads_GetCatPermission($cat,'addfile');

if ($user_info['is_guest'])
$groupid = -1;
else
$groupid =  $user_info['groups'][0];

$dbresult = $smcFunc['db_query']('', "
SELECT
c.ID_CAT, c.title, p.view, p.addfile
FROM {db_prefix}down_cat AS c
LEFT JOIN {db_prefix}down_catperm AS p ON (p.ID_GROUP = $groupid AND c.ID_CAT = p.ID_CAT)
WHERE c.redirect = 0 ORDER BY c.roworder ASC");
if ($smcFunc['db_num_rows']($dbresult) == 0)
fatal_error($txt['downloads_error_no_catexists'] , false);

$context['downloads_cat'] = array();
while($row = $smcFunc['db_fetch_assoc']($dbresult))
{
// Check if they have permission to add to this category.
if ($row['view'] == '0' || $row['addfile'] == '0' )
continue;

$context['downloads_cat'][] = array(
'ID_CAT' => $row['ID_CAT'],
'title' => $row['title'],
);
}
$smcFunc['db_free_result']($dbresult);

$result = $smcFunc['db_query']('', "
SELECT
title, defaultvalue, is_required, ID_CUSTOM
FROM  {db_prefix}down_custom_field
WHERE ID_CAT = " . $cat);
$context['downloads_custom'] = array();
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$context['downloads_custom'][] = array(
'ID_CUSTOM' => $row['ID_CUSTOM'],
'title' => $row['title'],
'defaultvalue' => $row['defaultvalue'],
'is_required' => $row['is_required'],
);
}
$smcFunc['db_free_result']($result);

// Get Quota Limits to Display
$context['quotalimit'] = Downloads_GetQuotaGroupLimit($user_info['id']);
$context['userspace'] = Downloads_GetUserSpaceUsed($user_info['id']);

$context['sub_template']  = 'add_download';

$context['page_title'] = $mbname . ' - ' . $txt['downloads_text_title'] . ' - ' . $txt['downloads_form_adddownload'];

// Check if spellchecking is both enabled and actually working.
$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');

// Needed for the WYSIWYG editor.
require_once($sourcedir . '/Subs-Editor.php');

// Now create the editor.
$editorOptions = array(
'id' => 'descript',
'value' => '',
'width' => '90%',
'form' => 'picform',
'labels' => array(
'post_button' => '',
),
);
create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];


}

function Downloads_AddDownload2()
{
global $txt, $scripturl, $modSettings, $sourcedir, $gd2, $user_info, $smcFunc;

isAllowedTo('downloads_add');

// If we came from WYSIWYG then turn it back into BBC regardless.
if (!empty($_REQUEST['descript_mode']) && isset($_REQUEST['descript']))
{
require_once($sourcedir . '/Subs-Editor.php');

$_REQUEST['descript'] = html_to_bbc($_REQUEST['descript']);

// We need to unhtml it now as it gets done shortly.
$_REQUEST['descript'] = un_htmlspecialchars($_REQUEST['descript']);

}


vbgamer45

Your missing the rest of Downloads_AddDownload2() That is part I am looking for.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Texan78

I've attached the Downloads2.php I found several refrences to AddDownloads2 and createpost function but, I didn't find those together. So not sure where to go from there or what exactly I am looking for or what variable to insert where. Any assistance would be great!

-Thanks!

vbgamer45

File isn't usable there looks like Mac formatting html around everything.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Texan78

Sorry about that, I am on a Mac so tried to save it in a way that could be opened on Windows since I am not sure Windows can open .rtf files from Mac. Try this one now and see you can open it.

-Thanks!

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Texan78

Thank you so much vbgamer45, that is perfect and exactly what I am looking for. Let me know how I can send you a donation for your help. Just a quick question, what files controls the html, css for how it is posted in a topic? I would like to make a small edit to space some things out, which that I should be able to handled, it's more my speed...LoL Also is the description from the downloads stored in the DB? Just curious because I noticed when you updated the description, it doesn't update the post, just curious. Not a huge deal, just would be nice to update the description and it update the post as well.

-Thanks!

vbgamer45

Quote from: Texan78 on May 16, 2012, 10:59:50 PM
Thank you so much vbgamer45, that is perfect and exactly what I am looking for. Let me know how I can send you a donation for your help. Just a quick question, what files controls the html, css for how it is posted in a topic? I would like to make a small edit to space some things out, which that I should be able to handled, it's more my speed...LoL Also is the description from the downloads stored in the DB? Just curious because I noticed when you updated the description, it doesn't update the post, just curious. Not a huge deal, just would be nice to update the description and it update the post as well.

-Thanks!

For the topic stuff that call is made in Downloads2.php in the AddDownloads2 function under createpost.
If you mean the layout of the template for downloads system that is in themes/default/downloads2.template.php

The description of the downloads is stored in the db in the smf_down_file database table in your forums database.


Have a donation link at http://www.smfhacks.com
You may also want to take a look at Downloads Pro http://www.smfhacks.com/download-system-pro.php
Which has option to add pictures, multifiles per download, and if you edit the description also edits/updates the post of the topic.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Texan78

If you look at the topic...

http://www.weather-connection.com/index.php/topic,19.0.html

I am just trying to put a space between the title, description and link. So that would be in the template file downloads2.template.php right? I also want to update the download link at the top with a download button on the actual downloads page. The button part will be easy.

I will send you a donation for your help this weekend when I get paid. Right now this mod is perfect for my needs even though to have the luxury to edit the description and have it also edit/update the post of the topic would be the only other thing I would need. Maybe if this site makes a little money I can upgrade. Images aren't really a big deal since they can post screen shots in the description.

-Thanks!

Texan78

This is the last thing I need to tweak and then I can officially launch my forum. If you look at the screen shot, what I am trying to do is put a space between the Title, Description, Link when it's posted on a topic.

I looked in downloads2 and Display.template and I can't find where to add the <br /> tag so it puts a space between the two. Any assistance would be very grateful.


vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Texan78

Thank you so much vbgamer45! That is perfect and exactly what I am needing.

I was able to figure out in the template how to change the text out and add a download button instead that I made so it is good to go now.

If you don't mind, could you show me a snippet of the code you edited so I can see exactly what you did and maybe learn what you did? I understand if you can't

-Thanks

Texan78

One other thing I would like to do that I just noticed is set default title to links when the thread is created. When a new download is submitted it creates a topic in a certain section of the forum I choose so there is support for that download. When it creates the link to the download in the topic it is the full URL. How would it be possible to set a default title so instead of it showing like this...



It would show like this with a default link title?



Now I found this in Downloads2.php and tried to change it to this.

// Create the post
require_once($sourcedir . '/Subs-Post.php');

$showpostlink = '[url=' . $scripturl . '?action=downloads;sa=view;down=' . $file_id . ']Download Script[/url]';


But it doesn't change anything.

How would I go about making that happen? Where do I need to look? Should be as simple as setting the default text correct?

-Thanks

Blackburn

Gerçek mutluluk mal ve mülke sahip olmak ile değil,akıl ve erdeme sahip olmak ile mümkündür.
Slax Tr - Slax Türkiye Topluluğu adresinden usb ile bile çalışan işletim sisteminin Türkiye sitesine ulaşabilirsin.
Özgür yaşam,özgür insan.

Advertisement: