Number of downloads

thomsa

Moderator
Staff member
Moderator
S.V.I.P Member
Collaborate
Registered
Joined
Jun 22, 2019
Messages
1,167
Points
173

Reputation:

@micke and this your want.

2023-06-22_13-58-16.png


use /admin.php?template-modifications/add&type=public

2023-06-22_19-13-58.jpg


search:

HTML:
                                    <xf:button href="{{ link('resources/download', $resource) }}" target="_blank"
                                        class="button--cta"
                                        data-xf-click="{{ $resource.CurrentVersion.file_count > 1 ? 'overlay' : '' }}"
                                        icon="download">{{ phrase('download') }}</xf:button>

replace:

HTML:
                                  <xf:set var="$attachment" value="{{ $resource.CurrentVersion.Attachments|first }}" />
                                    <xf:button href="{{ link('resources/download', $resource) }}" target="_blank"
                                        class="button--cta"
                                        data-xf-click="{{ $resource.CurrentVersion.file_count > 1 ? 'overlay' : '' }}"
                                        icon="download">{{ phrase('download') }} ({{ $attachment.getFileSize()|file_size }} /.{{ $attachment.getExtension() }})</xf:button><br />
                        <xf:if is="$resource.isDownloadable()">
                            <center>
                                downloads left:   <font color=red>{$resource.download_count|number}</font>
                            </center>
                        </xf:if>
 
Last edited:

micke

Collaborate
Collaborate
Registered
Joined
Sep 27, 2020
Messages
93
Points
43

Reputation:

@micke and this your want.

View attachment 35418

use /admin.php?template-modifications/add&type=public

View attachment 35419

search:

HTML:
                                    <xf:button href="{{ link('resources/download', $resource) }}" target="_blank"
                                        class="button--cta"
                                        data-xf-click="{{ $resource.CurrentVersion.file_count > 1 ? 'overlay' : '' }}"
                                        icon="download">{{ phrase('download') }}</xf:button>

replace:

HTML:
                                  <xf:set var="$attachment" value="{{ $resource.CurrentVersion.Attachments|first }}" />
                                    <xf:button href="{{ link('resources/download', $resource) }}" target="_blank"
                                        class="button--cta"
                                        data-xf-click="{{ $resource.CurrentVersion.file_count > 1 ? 'overlay' : '' }}"
                                        icon="download">{{ phrase('download') }} ({{ $attachment.getFileSize()|file_size }} /.{{ $attachment.getExtension() }})</xf:button><br />
                        <xf:if is="$resource.isDownloadable()">
                            <center>
                                downloads left:   <font color=red>{$resource.download_count|number}</font>
                            </center>
                        </xf:if>
thomsaYep, that's exactly what I want. :D:love:
 
View previous replies…

micke

Collaborate
Collaborate
Registered
Joined
Sep 27, 2020
Messages
93
Points
43

Reputation:

how do you limit that download count?
Zer01neIn Groups and permissions/User groups/Resource permissions
There is a plugin called [XenGenTr] RM Ekstra, using it you can set assume downloads.

Now thomsa answered before me.. :)
 

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,531
Points
523

Reputation:

In Groups and permissions/User groups/Resource permissions
There is a plugin called [XenGenTr] RM Ekstra, using it you can set assume downloads.

Now thomsa answered before me.. :)
mickeI do not think that this is the correct variable

$resource.download_count

is the number how many times this file has been downloaded.
 

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,531
Points
523

Reputation:

I didn't get it to match the number of downloads. :)
mickeSorry what did you not get?
You mean to get the downloads left for the download period time?
 

micke

Collaborate
Collaborate
Registered
Joined
Sep 27, 2020
Messages
93
Points
43

Reputation:

Exactly, that’s why I asked how you limit the downloads.
Zer01neOkay. If a member can download five files per day, the member has downloaded two files then I would like it to show how many downloads are left. If I understand you correctly.
 

Zer01ne

Collaborate
Collaborate
Registered
Joined
Nov 25, 2022
Messages
725
Points
253

Reputation:

Okay. If a member can download five files per day, the member has downloaded two files then I would like it to show how many downloads are left. If I understand you correctly.
mickeI understood that I don’t think the code will work for this purpose as you described.

If I am not wrong the code is for file download counts not for user-based criteria.
 

micke

Collaborate
Collaborate
Registered
Joined
Sep 27, 2020
Messages
93
Points
43

Reputation:

I understood that I don’t think the code will work for this purpose as you described.

If I am not wrong the code is for file download counts not for user-based criteria.
Zer01neOkay. That was sad to hear, you gave a good try anyway. Thanks for your help. ;) (y)
 

thomsa

Moderator
Staff member
Moderator
S.V.I.P Member
Collaborate
Registered
Joined
Jun 22, 2019
Messages
1,167
Points
173

Reputation:

I do not think that this is the correct variable

$resource.download_count

is the number how many times this file has been downloaded.
BattleKingthis code not use called [XenGenTr] RM Ekstra.
pic first post that move download counter to here.
 

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,531
Points
523

Reputation:

this code not use called [XenGenTr] RM Ekstra.
pic first post that move download counter to here.
thomsa@micke which limitation addon are you using?
Same question for all the others who has replied in that thread?
 

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,531
Points
523

Reputation:

Here we are:
1687796620990.png


After one download:
1687796641341.png


Like that?
 

Zer01ne

Collaborate
Collaborate
Registered
Joined
Nov 25, 2022
Messages
725
Points
253

Reputation:

BattleKing

Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
Joined
May 24, 2020
Messages
3,531
Points
523

Reputation:

Top